Hi! Im wondering if someone could please help me.
I am using Shopify’s “VOGUE” theme and can't seem to create the “added to cart” event for Klaviyo. I have been using this article in trying : https://help.klaviyo.com/hc/en-us/articles/115001396711
In this article, I use snippet 3 under the “theme.liquid” section (using class notation). Here is what shows up with I “inspect” my add to cart button on my website:
<input type="submit" class="button product-add-available pn-button-5a1rxhfa4yq" value="Add to cart">
Thus I hope I correctly assumed that I should use snippet 3 in the above article, using class notation.
This is what it looks like when I try to code it in:
{% if product %}
<script type="text/javascript">
var _learnq = _learnq || l];
var classname = document.getElementsByClassName("button product-add-available pn-button-p3ysqtfmy99");
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>
{% endif %}
I still cannot seem to get it to work . Could someone please help me? Maybe it has something to do with my theme on Shopify. I would really appreciate it!
Thank you in advance
Katarina