Shopify themes, liquid, logos, and UX
Hi everyone, I'm trying to pass some Liquid variables inside transaction object from order object, how can I do it? Something like that:
{% for transaction in order.transactions %}
let transaction_amount = {{ transaction.amount }};
let transaction_gateway {{ transaction.gateway }}
{% endfor %}
Thanks in advance.
Yes, like that. Although if you're looping through transactions, rather than redefine the JS variable each time, I would push them into an array of objects ( let transactions = []; ).
Note: You're missing a semicolon after the 2nd variable declaration.
Note 2: I would make the transaction amount a string, just in case you get some unexpected data, otherwise your script will break. ( let transaction_amount = "{{ transaction.amount }}"; )
Hi, Are there any way to directly pass
order.transactions
to javasript then loop at js side?
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024