Skip to content

Instantly share code, notes, and snippets.

@karthik20522
Created May 25, 2019 07:21
Show Gist options
  • Save karthik20522/a19b3954c6874c73c66d99677d8dd7ca to your computer and use it in GitHub Desktop.
Save karthik20522/a19b3954c6874c73c66d99677d8dd7ca to your computer and use it in GitHub Desktop.
shopify cart tracking
<script type="text/javascript">
var productsArray = [];
{% for item in cart.items %}
item = {
'sku': '{{ item.sku }}',
'price': {{ item.price | money_without_currency }},
'size': '{{ item.variant.option2 }}',
'quantity': {{ item.quantity }}
}
productsArray.push( item );
{% endfor %}
var shpfy_track = {
type: "bucket",
products: productsArray
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment