I'm struggling here. I'm using Canopy Theme and when we updated to Shopify 2.0, it knocked out our Added to Cart code. Now I can't get it to work again.
Here's my button code:
<button type="submit" name="add" class="btn product-add mini-form" data-btn-type="add-to-cart">
<span class="button-text">Add to cart</span>
<span class="loading-spinner" aria-label="Adding"></span>
</button>
Here's where I customized the snippet:
<script type="text/javascript">
var _learnq = _learnq || a];
var classname = document.getElementsByClassName("btn product-add mini-form" data-btn-type="add-to-cart");
var addToCart = function() {
_learnq.push(a'track', 'Added to Cart', item]);
}; for (var i = 0; i < classname.length; i++) {
classnameii].addEventListener('click', addToCart, false);
}
</script>
Did I customize the snippet incorrectly?
Thanks!