true, 'thankyou' => true, 'account' => true, 'cart' => false, ]; $should_override = false; if (!empty($checkout_pages['checkout']) && is_checkout() && !is_order_received_page()) { $should_override = true; } if (!empty($checkout_pages['thankyou']) && is_order_received_page()) { $should_override = true; } if (!empty($checkout_pages['account']) && is_account_page()) { $should_override = true; } if (!empty($checkout_pages['cart']) && is_cart()) { $should_override = true; } if ($should_override) { $spa_template = plugin_dir_path(dirname(dirname(__FILE__))) . 'templates/spa-full-page.php'; if (file_exists($spa_template)) { return $spa_template; } } return $template; } // Mode 2: Full SPA if ($mode === 'full') { // Override all WooCommerce pages if (is_woocommerce() || is_product() || is_cart() || is_checkout() || is_account_page()) { $spa_template = plugin_dir_path(dirname(dirname(__FILE__))) . 'templates/spa-full-page.php'; if (file_exists($spa_template)) { return $spa_template; } } } return $template; } /** * Start SPA wrapper */ public static function start_spa_wrapper() { // Check if we should use SPA if (!self::should_use_spa()) { return; } // Determine page type $page_type = 'shop'; $data_attrs = 'data-page="shop"'; if (is_product()) { $page_type = 'product'; global $post; $data_attrs = 'data-page="product" data-product-id="' . esc_attr($post->ID) . '"'; } elseif (is_cart()) { $page_type = 'cart'; $data_attrs = 'data-page="cart"'; } elseif (is_checkout()) { $page_type = 'checkout'; $data_attrs = 'data-page="checkout"'; } elseif (is_account_page()) { $page_type = 'account'; $data_attrs = 'data-page="account"'; } // Output SPA mount point echo '
' . esc_html__('Loading...', 'woonoow') . '
'; echo '