Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
674 B
1
Indexable
Never
   <script>
      window.SLIDECART_ADD_TO_CART = function({ id, quantity }) {
        // Fires whenever an item has been added to cart
      dataLayer.push({
      'event': 'ga4_add_to_cart',
      		'items': [{
      		'item_id': '{{ product.id }}',
      		'item_name': '{{ product.title | remove: "'" | remove: '"' }}',
      		'item_brand': '{{ product.vendor | remove: "'" | remove: '"' }}',
              'item_cat': '{{ product.collections.last.title | remove: "'" | remove: '"' }}',
      		'variant_id': '{{ product.first_available_variant.id }}',
      		'currency': '{{ shop.currency }}',
      		'price': '{{ product.price  | times: 0.01}}'
      		}]

      });