Liquid, JavaScript, themes, sales channels
Hi,
On my site, I’m displaying the products’ price both with and without taxes:
...using this code:
<p>{{ product.price | money }} <small>{{ product.price | times:1.2 | money }} inc. VAT</small></p>
However, there are a couple of items where tax is not charged (the "Charge tax on this product" option in the control panel is unchecked). Is there any way to only display the price including tax only on those items where tax is charged?
Something along these lines:
{% if tax_charged == true %}
<small>{{ product.price | times:1.2 | money }} inc. VAT</small>
{% endif %}
...but with legitimate Liquid. Are there any Liquid options for this sort of thing?
Many thanks,
Andy
Hi @andygosling,
Please change the code:
{% if tax_charged == true %}
<small>{{ product.price | times:1.2 | money }} inc. VAT</small>
{% endif %}
=>
{% if tax_line.price != blank %}
<small>{{ product.price | times:1.2 | money }} inc. VAT</small>
{% endif %}
Hope it helps!
If my answer can help you solve your issue, please mark it as a solution. Thank you and good luck.
Hi there,
Many thanks for your response. I tried your solution but unfortunately, it hid the price-with-tax for all products (including those ones tax is charged on).
I wasn’t aware of the tax_line object previously, so thank you for bringing it to my attention.
I tried adding {{ tax_line.rate }} and {{ tax_line.title }} to my code, just to see what the output would be, but it didn’t output anything at all, so I’m not sure what’s going on there!
Thanks again,
Andy
Hi @andygosling,
You can refer https://help.shopify.com/en/manual/intro-to-shopify/initial-setup/sell-in-germany/price-per-unit
Or https://github.com/Shopify/dawn/blob/main/sections/main-product.liquid#L90 . https://i.imgur.com/KtpiTdN.png
Hope it helps!
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