Liquid, JavaScript, themes, sales channels
Hello.
Some of variables in my script does not work. Could you check why?
It only gives back the numer of the order.
Here is the script:
<script>
x('track', 'Purchase', {
transaction_id: '{{order.name}}',
value: {{order.totalPriceSet.shopMoney.amount}},
shipping_cost: {{order.totalShippingPriceSet.shopMoney.amount}},
discount_code: '{{order.discountCode}}',
contents: [
{% for a in order.lineItems %}
{
id: '{{a.id}}',
name: '{{a.title}}',
ean: '{{a.sku}}',
price: {{a.originalUnitPriceSet.shopMoney.amount}},
quantity: {{a.quantity}},
in_stock: ‘true’
},
{% endfor %}
]
});
And here is the outcome:
Any help would be really appreciated.
Thanks in advance.
Hello , @asd123
May be you can try like this :-
x('track', 'Purchase', {
transaction_id: '{{order.name}}',
value: {{order.total_price | money}},
shipping_cost: {{order.shipping_price | money}},
{% for discount_application in order.discount_applications %}
discount_code: '{{discount_application.title}}',
{% endfor %}
contents: [
{% for a in order.lineItems %}
{
id: '{{a.id}}',
name: '{{a.title}}',
ean: '{{a.sku}}',
price: {{a.originalUnitPriceSet.shopMoney.amount}},
quantity: {{a.quantity}},
in_stock: ‘true’
},
{% endfor %}
]
});
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024