AJAX behavior in the xstore theme conflicting with tracking events.

This topic has 2 replies, 2 voices, and was last updated 1 week, 4 days ago ago by Andrew Mitchell

  • Avatar: Rana
    Rana
    Participant
    April 6, 2026 at 20:17

    Hello XStore Support,

    I am experiencing a serious issue with tracking events on my WooCommerce store that appears to be related to AJAX behavior in the theme.

    **Problem:**

    * Add to Cart sometimes fires correctly
    * However, when navigating to Cart and Checkout pages:

    * View Cart / Initiate Checkout events are inconsistent or missing
    * In some cases, events briefly fire and then disappear

    **What I have already checked:**

    * Disabled all caching (server + plugin)
    * Disabled AJAX-related options where possible
    * Enabled “Always load wc-cart-fragments”
    * No JS errors related to tracking
    * Cookie consent is correctly handled (Cookiebot)

    **Important observation:**
    It looks like the DOM is being dynamically replaced (possibly via AJAX), which causes tracking scripts (Meta Pixel / Google Tag / GA4) to lose context or not fire reliably.

    **My questions:**

    1. Does XStore use AJAX or PJAX for Cart / Checkout rendering by default?
    2. Is there any hidden AJAX behavior that could interfere with JavaScript tracking events?
    3. Is there a recommended way to ensure WooCommerce hooks (cart/checkout) work reliably with tracking scripts?
    4. Can you confirm if XStore modifies WooCommerce checkout flow in a way that affects JS execution?

    This issue is directly affecting conversion tracking and campaign performance, so I would really appreciate a precise technical clarification.

    Thank you.

    1 Answer
    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    April 7, 2026 at 06:38

    Hello, Rana,

    Thank you for the detailed explanation – it really helps to understand the situation.

    To clarify your questions:
    1. XStore does not use PJAX for Cart or Checkout pages by default. These pages rely on the standard WooCommerce flow, which includes built-in AJAX mechanisms (such as cart fragments and checkout updates) to dynamically refresh parts of the page.
    2. There is no hidden PJAX-like behavior from the theme affecting these pages. However, WooCommerce itself updates parts of the DOM via AJAX during cart and checkout interactions. This can sometimes affect JavaScript-based tracking if it depends only on the initial page load.
    3. For reliable tracking, it’s generally recommended to not rely solely on page load events (like DOMContentLoaded). Instead, tracking scripts should also listen to WooCommerce-related JavaScript events or be re-initialized after dynamic updates. This ensures events like “View Cart” or “Initiate Checkout” are consistently captured even after AJAX refreshes.
    4. XStore may enhance or style WooCommerce components (such as mini-cart behavior or UI elements), but it does not replace the core WooCommerce checkout flow in a way that would fundamentally alter JavaScript execution.

    Based on your description, the behavior you’re seeing is most likely related to how dynamic DOM updates (from WooCommerce AJAX) interact with tracking scripts, rather than a specific issue caused by the theme itself.

    If needed, we can share general best practices for hooking tracking events into WooCommerce lifecycle events to improve consistency.

    Best Regards,
    8Theme’s Team

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.