diff --git a/build-production.sh b/build-production.sh index 0a0f25b..12c1940 100755 --- a/build-production.sh +++ b/build-production.sh @@ -68,11 +68,15 @@ echo "Copying SPA build files..." mkdir -p ${BUILD_DIR}/${PLUGIN_NAME}/customer-spa/dist mkdir -p ${BUILD_DIR}/${PLUGIN_NAME}/admin-spa/dist -# Customer SPA - only app.js and app.css +# Customer SPA - app.js, app.css, and fonts cp customer-spa/dist/app.js ${BUILD_DIR}/${PLUGIN_NAME}/customer-spa/dist/ cp customer-spa/dist/app.css ${BUILD_DIR}/${PLUGIN_NAME}/customer-spa/dist/ +if [ -d "customer-spa/dist/fonts" ]; then + cp -r customer-spa/dist/fonts ${BUILD_DIR}/${PLUGIN_NAME}/customer-spa/dist/ + echo "✓ Copied customer-spa fonts" +fi -# Admin SPA - only app.js and app.css (no dynamic imports for now) +# Admin SPA - app.js and app.css cp admin-spa/dist/app.js ${BUILD_DIR}/${PLUGIN_NAME}/admin-spa/dist/ cp admin-spa/dist/app.css ${BUILD_DIR}/${PLUGIN_NAME}/admin-spa/dist/ diff --git a/includes/Frontend/TemplateOverride.php b/includes/Frontend/TemplateOverride.php index 0fd0319..0f2c0f7 100644 --- a/includes/Frontend/TemplateOverride.php +++ b/includes/Frontend/TemplateOverride.php @@ -71,8 +71,22 @@ class TemplateOverride { $settings = get_option('woonoow_customer_spa_settings', []); $mode = isset($settings['mode']) ? $settings['mode'] : 'disabled'; - // Mode 1: Disabled + // Mode 1: Disabled - but still check for shortcodes if ($mode === 'disabled') { + // Check if page has woonoow shortcodes + global $post; + if ($post && ( + has_shortcode($post->post_content, 'woonoow_shop') || + has_shortcode($post->post_content, 'woonoow_cart') || + has_shortcode($post->post_content, 'woonoow_checkout') || + has_shortcode($post->post_content, 'woonoow_account') + )) { + // Use blank template for shortcode pages too + $spa_template = plugin_dir_path(dirname(dirname(__FILE__))) . 'templates/spa-full-page.php'; + if (file_exists($spa_template)) { + return $spa_template; + } + } return $template; } @@ -254,16 +268,35 @@ class TemplateOverride { $settings = get_option('woonoow_customer_spa_settings', []); $mode = isset($settings['mode']) ? $settings['mode'] : 'disabled'; - // Only remove in full mode - if ($mode !== 'full') { - return false; + // Check if we're on a WooCommerce page in full mode + if ($mode === 'full') { + if (is_shop() || is_product() || is_cart() || is_checkout() || is_account_page() || is_woocommerce()) { + return true; + } } - // Check if we're on a WooCommerce page - if (is_shop() || is_product() || is_cart() || is_checkout() || is_account_page() || is_woocommerce()) { + // Also remove for pages with shortcodes (even in disabled mode) + global $post; + if ($post && ( + has_shortcode($post->post_content, 'woonoow_shop') || + has_shortcode($post->post_content, 'woonoow_cart') || + has_shortcode($post->post_content, 'woonoow_checkout') || + has_shortcode($post->post_content, 'woonoow_account') + )) { return true; } + // Special check for Shop page (archive) + if (function_exists('is_shop') && is_shop()) { + $shop_page_id = get_option('woocommerce_shop_page_id'); + if ($shop_page_id) { + $shop_page = get_post($shop_page_id); + if ($shop_page && has_shortcode($shop_page->post_content, 'woonoow_shop')) { + return true; + } + } + } + return false; }