Add to cart trigger (Metric) not working for Wokiee Theme (Shopify)

  • 25 May 2022
  • 1 reply

Badge +2


I know this question has been raised a lot of times, but I can’t figure it out. The add to cart trigger (Metric) is not working. 

I’ve posted all the Code in the product-template.liquid (Sections) because Wokiee theme does not have a product.liquid. 

I’ve also tried both variants (class and ID) - still no metrics. 

I already see viewed product event associated with Mail (cookied)

Would be great if somebody could help me on that. 

Thank you very much




<script type="text/javascript">

var _learnq = _learnq || [];

document.getElementById("teeAtcButton").addEventListener('click',function (){

  _learnq.push(['track', 'Added to Cart', item]);





<script type="text/javascript">

var _learnq = _learnq || [];

  var classname = document.getElementsByClassName("tee-btn tee-btn--atc");

var addToCart = function() {

_learnq.push(['track', 'Added to Cart', item]);

}; for (var i = 0; i < classname.length; i++) {

classname[i].addEventListener('click', addToCart, false);




Best answer by Taylor Tarpley 26 May 2022, 17:02

View original

1 reply

Userlevel 7
Badge +60

Hi @TrustyPets


Thanks for sharing your question in the Community, happy to help! 


According to your screenshots, it appears that the code in your large screenshot looks correct as the screenshot of you button’s code at the top reflects that the button ID’s should be used for proper instillation. Your viewed product snippet is above your added to cart snippet as well, which is also needed to be properly located in order to fire. One concern I have is the placement of the code. As Wokiee is a Shopify 2.0 Theme, have you followed the steps, outlined in our Added to Cart documentation ,on how to input the snippet in your theme’s custom liquid blocks? My fellow Community manager explains it step by step in this similar thread below.


Additionally, I’d investigate your snippet’s code again with a fine-tooth comb, i.e. looking for any extra spaces or letters comparing it to the example code in our help center article, as even something this small can cause your metric to be unsuccessful. However, if you are not able to find a solution after looking through these additional Community threads for more insight, I would reach out to Support to help you solve this issue.


Thanks for participating in the Community!