From c8ce892d159ed806000a788e36ebf95789692043 Mon Sep 17 00:00:00 2001 From: Dwindi Ramadhana Date: Tue, 30 Dec 2025 17:59:49 +0700 Subject: [PATCH] debug: Add Shop page diagnostic script for live site troubleshooting --- check-shop-page.php | 98 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 check-shop-page.php diff --git a/check-shop-page.php b/check-shop-page.php new file mode 100644 index 0000000..ff31d1d --- /dev/null +++ b/check-shop-page.php @@ -0,0 +1,98 @@ +WooNooW Shop Page Diagnostic'; + +// 1. Check WooCommerce Shop Page ID +$shop_page_id = get_option('woocommerce_shop_page_id'); +echo '

1. WooCommerce Shop Page Setting

'; +echo '

Shop Page ID: ' . ($shop_page_id ? $shop_page_id : 'NOT SET') . '

'; + +if ($shop_page_id) { + $shop_page = get_post($shop_page_id); + if ($shop_page) { + echo '

Shop Page Title: ' . esc_html($shop_page->post_title) . '

'; + echo '

Shop Page Status: ' . esc_html($shop_page->post_status) . '

'; + echo '

Shop Page URL: ' . get_permalink($shop_page_id) . '

'; + echo '

Shop Page Content:

'; + echo '
' . esc_html($shop_page->post_content) . '
'; + + // Check for shortcode + if (has_shortcode($shop_page->post_content, 'woonoow_shop')) { + echo '

✓ Has [woonoow_shop] shortcode

'; + } else { + echo '

✗ Missing [woonoow_shop] shortcode

'; + } + } else { + echo '

ERROR: Shop page not found!

'; + } +} + +// 2. Find all pages with woonoow shortcodes +echo '

2. Pages with WooNooW Shortcodes

'; +$pages_with_shortcodes = get_posts([ + 'post_type' => 'page', + 'post_status' => 'publish', + 'posts_per_page' => -1, + 's' => 'woonoow_', +]); + +if (empty($pages_with_shortcodes)) { + echo '

No pages found with woonoow_ shortcodes

'; +} else { + echo ''; +} + +// 3. Check Customer SPA Settings +echo '

3. Customer SPA Settings

'; +$spa_settings = get_option('woonoow_customer_spa_settings', []); +echo '
' . print_r($spa_settings, true) . '
'; + +// 4. Check if pages were created by installer +echo '

4. WooNooW Page Options

'; +$woonoow_pages = [ + 'shop' => get_option('woonoow_shop_page_id'), + 'cart' => get_option('woonoow_cart_page_id'), + 'checkout' => get_option('woonoow_checkout_page_id'), + 'account' => get_option('woonoow_account_page_id'), +]; + +foreach ($woonoow_pages as $key => $page_id) { + echo '

' . ucfirst($key) . ' Page ID: ' . ($page_id ? $page_id : 'NOT SET'); + if ($page_id) { + $page = get_post($page_id); + if ($page) { + echo ' - ' . esc_html($page->post_title) . ' (' . $page->post_status . ')'; + } else { + echo ' - PAGE NOT FOUND'; + } + } + echo '

'; +} + +echo '
'; +echo '

Recommended Actions:

'; +echo '
    '; +echo '
  1. If Shop page doesn\'t have [woonoow_shop] shortcode, add it to the page content
  2. '; +echo '
  3. If Shop page ID doesn\'t match WooCommerce setting, update WooCommerce > Settings > Products > Shop Page
  4. '; +echo '
  5. If SPA mode is "disabled", it will only load on pages with shortcodes
  6. '; +echo '
  7. If SPA mode is "full", it will load on all WooCommerce pages
  8. '; +echo '
';