My Add to Cart Tag is Not Firing

If your add to cart tag is not firing after installing GTM Suite then follow this guide to add a backup trigger.

If you've installed and tested the GTM Suite but are still not seeing the add to cart events fire on your product page then follow these steps to fix:

 

Step 1: Custom HTML Add to Cart Tag

Step 2: Update Trigger

Step 3: Update elevar-body-end.liquid file

Step 1: Custom HTML Add to Cart Tag

Ensure you have this tag in your GTM container:

Screen Shot 2019-06-23 at 7.33.51 PM

If you don't have this then download the GTM container here. 

Once you've downloaded then import this into your own GTM account and be sure you select MERGE and not overwrite. 

Step 2: Update Trigger

Your next step is to put GTM into preview mode so you can browse your site to see the GTM console-like shown below. 

Navigation to your product page > click add to cart > and you should see a Click event on the left like this:

Screen Shot 2019-06-23 at 7.42.42 PM

If you have a Click Class, Click Element, Click ID or Click Text then go back to GTM and update the Trigger to match the variable detail from the add to cart click. 

In my example above I'm using the Click Classes so I've updated my trigger to look like this:

Screen Shot 2019-06-23 at 7.43.59 PM

One you save then you are good to go. 

Inside of GTM click "Refresh" on your preview mode > then refresh your product page browser of your website. Once it reloads then click add to cart again and you should see the add to cart tags fire successfully. 

Step 3: Update elevar-body-end.liquid file - (For App installations prior to 11/1/2019 )

 

We have found that for more customized, non-native themes the add to cart tag may still not fire even after making the adjustment described above. For stores that installed the Shopify GTM App prior to 11/1/2019, all that is needed is a small update to the elevar-body-end.liquid file for an immediate fix.   

If you installed the App after 11/1/2019, the most up to date code is already in place! 

 

Here is how you make this update:

  1. On your Shopify Theme Preferences, select 'edit code' in the actions dropdown
  2. Search for elevar-body-end.liquid
  3. Replace this line:

 



With this:
document.querySelectorAll("form[action^='/cart/add'] [type='submit']")[0].addEventListener('click', function() {
 
4. Save and you're all set!

 

Back to Top 🔝