Hello,
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
![](https://uploads-us-west-2.insided.com/klaviyo-en/attachment/2294c60a-a255-4175-b064-dadc0d4313e4.png)
![](https://uploads-us-west-2.insided.com/klaviyo-en/attachment/9e8ffc39-088b-4f68-be21-abfde24083c2.png)
ID
<script type="text/javascript">
var _learnq = _learnq || [];
document.getElementById("teeAtcButton").addEventListener('click',function (){
_learnq.push(['track', 'Added to Cart', item]);
});</script>
CLASS
<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);
}
</script>
Best answer by Taylor Tarpley
View original