/** * Plugin Name: WooCommerce Chatbot * Description: Chatbot for WooCommerce: order status, product search, account details, and redirects. * Version: 1.0.0 * Author: (You) * Text Domain: wc-chatbot */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! defined( 'WC_CHATBOT_DIR' ) ) { define( 'WC_CHATBOT_DIR', plugin_dir_path( __FILE__ ) ); define( 'WC_CHATBOT_URL', plugin_dir_url( __FILE__ ) ); define( 'WC_CHATBOT_VERSION', '1.0.0' ); } register_activation_hook( __FILE__, 'wc_chatbot_activate' ); register_deactivation_hook( __FILE__, 'wc_chatbot_deactivate' ); function wc_chatbot_activate() { if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) && ! class_exists( 'WooCommerce' ) ) { add_option( 'wc_chatbot_activation_notice', true ); } } function wc_chatbot_deactivate() { // cleanup if needed } require_once WC_CHATBOT_DIR . 'includes/class-wc-chatbot.php'; add_action( 'plugins_loaded', function(){ if ( class_exists( 'WC_Chatbot' ) ) { $GLOBALS['wc_chatbot'] = new WC_Chatbot(); } else { add_action( 'admin_notices', function(){ echo '
WC Chatbot failed to initialize.