Personalized checkout and custom promotions with Shopify Scripts
Hello,
I have add that script in checkout page:
<!-- Send the Item data for each item in the shopping cart -->
<script>
{% for item in order.line_items %}
skroutz_analytics('ecommerce', 'addItem', JSON.stringify({
order_id: '{{ checkout.id }}',
product_id: '{{ item.product.id }}',
name: '{{ item.product.title | escape }}', // Product Name. Required.
price: '{{ item.price | money_without_currency }}',
quantity: '{{ item.quantity }}'
}));
{% endfor %}
</script>
Τhe script does not appear on the thank you page. Only if I refresh the thank you page does the script appear
I also tried to put the {% for line_item in order.line_items %} in the whole code but it still didn't work. Only when I refreshed the page did it bring results.
Ιf I remove the command {% for item in order.line_items %} and {% endfor %} then the script works normally but brings an empty result.
what is wrong with the code?
Best regards,
Alex
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024