boot(); }); // Declare HPOS (High-Performance Order Storage) compatibility so the plugin // works on stores using WooCommerce's custom order tables. add_action('before_woocommerce_init', function () { if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) { \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', ADVERSHIPS_AFF_FILE, true ); } }); // Activation: nothing destructive — just stash the version for future migrations. register_activation_hook(__FILE__, function () { add_option('adverships_affiliate_activated_version', ADVERSHIPS_AFF_VERSION); }); // Deactivation: clear the sales-alerts WP-Cron event so we don't leave an // orphaned schedule behind. (Re-armed automatically on next load when the // store is connected and alerts are enabled.) register_deactivation_hook(__FILE__, function () { if (class_exists('Adverships_Affiliate_Alerts')) { Adverships_Affiliate_Alerts::unschedule(); } });