get_charset_collate(); // Create bundle products table $table_name = $wpdb->prefix . 'qbnd_bundle_products'; $sql = "CREATE TABLE IF NOT EXISTS $table_name ( id bigint(20) NOT NULL AUTO_INCREMENT, bundle_id bigint(20) NOT NULL, product_id bigint(20) NOT NULL, quantity int(11) NOT NULL DEFAULT 1, min_quantity int(11) NOT NULL DEFAULT 1, max_quantity int(11) DEFAULT NULL, discount_type varchar(20) DEFAULT NULL, discount_value decimal(10,2) DEFAULT NULL, PRIMARY KEY (id), KEY bundle_id (bundle_id), KEY product_id (product_id) ) $charset_collate;"; // Create bundle meta table $table_name = $wpdb->prefix . 'qbnd_bundle_meta'; $sql .= "CREATE TABLE IF NOT EXISTS $table_name ( id bigint(20) NOT NULL AUTO_INCREMENT, bundle_id bigint(20) NOT NULL, meta_key varchar(255) NOT NULL, meta_value longtext, PRIMARY KEY (id), KEY bundle_id (bundle_id), KEY meta_key (meta_key(191)) ) $charset_collate;"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); // Set version add_option('qbnd_version', '1.0.0'); // Reset tracking options on activation delete_option('qbnd_tracking_consent'); delete_option('qbnd_tracking_consent_shown'); delete_option('qbnd_installation_tracked'); } register_activation_hook(__FILE__, 'qbnd_activate'); // Deactivation hook function qbnd_deactivate() { // Clean up temporary data delete_transient('qbnd_installing'); } register_deactivation_hook(__FILE__, 'qbnd_deactivate'); // Load core files function qbnd_load_core_files() { // Check if WooCommerce is active if (!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) { add_action('admin_notices', function () { ?>