'threeplnext_wc_token', 'myapp_wc_email' => 'threeplnext_wc_email', 'myapp_wc_store_url' => 'threeplnext_wc_store_url', 'myapp_wc_key_id' => 'threeplnext_wc_key_id', 'myapp_wc_consumer_key' => 'threeplnext_wc_consumer_key', 'myapp_wc_consumer_secret' => 'threeplnext_wc_consumer_secret', 'myapp_wc_webhook_status' => 'threeplnext_wc_webhook_status', ); foreach ($migrations as $old_key => $new_key) { $current = threeplnext_wc_get_option($new_key, null); if ($current !== null && $current !== '') { continue; } $old_value = threeplnext_wc_get_option($old_key, null); if ($old_value !== null && $old_value !== '') { threeplnext_wc_update_option($new_key, $old_value); } } } /** * Activation: verify WooCommerce is active. */ function threeplnext_wc_activate(): void { if (!function_exists('is_plugin_active')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $wc_active = is_plugin_active('woocommerce/woocommerce.php') || is_plugin_active_for_network('woocommerce/woocommerce.php'); if (!$wc_active) { deactivate_plugins(plugin_basename(__FILE__)); wp_die( esc_html__('3plnext requires WooCommerce to be active.', '3plnext'), esc_html__('Plugin activation failed', '3plnext'), array('back_link' => true) ); } threeplnext_wc_migrate_options(); } register_activation_hook(__FILE__, 'threeplnext_wc_activate'); /** * Initialize plugin. */ function threeplnext_wc_init(): void { if (!class_exists('WooCommerce')) { add_action('admin_notices', function () { echo '
' . esc_html__('3plnext requires WooCommerce to be active.', '3plnext') . '