Prestige theme bug-Duplicate Add to Cart

Prestige theme bug-Duplicate Add to Cart

Tarek_K
New Member
4 0 0

The Add to Cart event is firing twice in the Prestige theme. All other events are firing normally. We are using the native Shopify set up for both Google and Facebook tracking, and there is no duplicate manual code inserted. The duplicate Add to Cart issue is happening in both Google and Meta pixel tracking. We tested with the Dawn theme and the Add to Cart fired only once, so the issue is only happening when we are using the Prestige theme. We contacted Maestroo, the theme developers, and they said they don't have access to how Shopify's tracking works, so they can't help us with the issue. We are in contact with Shopify now, but so far, there is no solution.

 

Are there any other Prestige users facing this issue?? Thanks.

 

Website link 

 

google-tag-assistant-debug.png

Reply 1 (1)

VipulBudhiraja
Explorer
61 5 7

The issue of the double "Add to Cart" event in the Prestige theme could be caused by how the theme interacts with Shopify’s native tracking setup. Here are some troubleshooting steps and potential solutions:

Solution

  1. Check for Double Event Listeners in the Prestige Theme Code:

    • In your theme files, inspect the code related to the "Add to Cart" function. It’s possible there’s a duplicate listener triggering the event twice.
    • Go to Online Store > Themes > Actions > Edit Code. In theme.js or main.js files, search for the “Add to Cart” functionality. Look for duplicated event listeners (e.g., click, submit) attached to the "Add to Cart" button.
  2. Review theme.liquid and Cart Snippets:

    • Sometimes, tracking scripts can get duplicated in the theme.liquid file, especially if they are included in both the header and body sections.
    • Open theme.liquid and ensure the tracking scripts are only included once. Also, check any cart-related Liquid snippets (e.g., cart.liquid, cart-template.liquid) to make sure there isn’t an extra tracking script embedded within them.
  3. Disable AJAX Cart Temporarily (for Testing):

    • The AJAX functionality in some themes can cause double event firing, especially if the theme sends two network requests upon clicking "Add to Cart." Try disabling AJAX to see if it resolves the issue.
    • This can often be toggled in Theme Settings > Cart. If it’s not possible, you may need to temporarily modify the code in the ajax-cart.js or cart.js file to disable AJAX for testing.
  4. Check for External App Interference:

    • Some apps can cause duplicate events if they add their own "Add to Cart" tracking. Disable third-party apps one by one to see if any are adding additional tracking scripts or listeners.
  5. Implement Custom Script to Prevent Duplicate Events:

    • If the double firing persists, you can add a custom script to prevent the duplicate “Add to Cart” event. Here’s an example:
      javascript
      Copy code
      let addToCartFired = false; document.querySelector('.add-to-cart-button').addEventListener('click', function() { if (!addToCartFired) { addToCartFired = true; // Place your tracking code here setTimeout(() => addToCartFired = false, 1000); // Resets after 1 second } });
    • This script ensures the “Add to Cart” event only fires once within a set period.

Experience personalized shopping and real-time support with the Debales AI Chatbot on Shopify! Engage customers effortlessly and help them find the right products—let’s chat!

Please let us know if our reply is helpful by giving it a Like or marking it as a Solution!