Untitled

 avatar
unknown
plain_text
2 years ago
790 B
7
Indexable
i have below script in shopify


<script>
window.SLIDECART_REMOVED_FROM_CART = async function({ id }) {
// Fires whenever an item is removed from cart
let responsevariant = await fetch(`/variants/${id}.json`, {method: 'GET'});
let allVariantInfo = await responsevariant.json();

console.log(allVariantInfo);

dataLayer.push({
event: "ga4_remove_from_cart",
items: [{
'item_id': '{{ product.id }}',
'item_name': '{{ product.title | remove: "'" | remove: '"' }}',
'item_brand': '{{ product.vendor | remove: "'" | remove: '"' }}',
'item_category': '{{ product.collections[0].title | remove: "'" | remove: '"' }}',
'variant_id': '{{ product.selected_variant.sku }}',
'currency': '{{ shop.currency }}',
'price': '{{ product.price | times: 0.01}}'
}]
});

}
</script>

Editor is loading...