Shopify themes, liquid, logos, and UX
Hello 👋 I have a question and really hoping that someone can help with this . I currently have set the prices of the products to show with and without tax. It is showing it on all products and the calculation is correct, however I would like to show a text saying no tax on products that have the charge tax on product ticked off in the product settings when adding the product . Does anyone know how to address the ‘charge tax on this product’ so I can create an if statement. Thank you in advance for your help . Basically I would like to have an if statement checking if the charge tax on product is true and based on that to display different things !
Solved! Go to the solution
This is an accepted solution.
Yes @Hushhush
{% if product.selected_or_first_available_variant.taxable %}
<span>Price Excl VAT </span>
{% else %}
<span>Price Incl VAT </span>
{% endif %}
You can write like this on price.liquid in Dawn theme
It will show on product page as well as on collection pages and on every product card
You can adjust the code if needed as per your requirement
Thanks!
This is an accepted solution.
What I did is deleted that same code from the main-product.liquid where is the {%if cart.taxes_included %} it seems to done the job not to show anywhere except where the product is set as charge tax on this product . Do you think this change is ok to be done compared to your solution?! Thank you for the help , your answers really helped me a lot in my task.
Hi @Hushhush
You can use an if statement like this
{% if product.selected_or_first_available_variant.taxable %}
Write your code here
{% endif %}
Thanks!
This looks like awesome solution but would this work when the products are displayed as a collection? At the moment I have a normal price and added a code to display the without tax price . I would like to display the without tax only on collections and products that have got no tax.
for example every product has a the below prices but wont to display excl tax only when product “charge tax on this product” is ticked ✅
Price Incl VAT 49.90 £
Price Excl VAT 46.90 £ Maybe I am wrong here as my head is everywhere. Really appreciate your prompt replay man
Maybe I need to add that I am putting the code in the price.liquid file too . Using Dawn theme
This is an accepted solution.
Yes @Hushhush
{% if product.selected_or_first_available_variant.taxable %}
<span>Price Excl VAT </span>
{% else %}
<span>Price Incl VAT </span>
{% endif %}
You can write like this on price.liquid in Dawn theme
It will show on product page as well as on collection pages and on every product card
You can adjust the code if needed as per your requirement
Thanks!
Brilliant works perfect . One thing is that when I open the product and it opens it in the default product template is showing both prices again. Is there anywhere else I need to change the code? Don’t want it showing when the product is open . Is there a different liquid file I need to add the above code? Thank you so much for your help
It should show only once like this
On Dawn theme, same price.liquid is used on cards as well product details page
To hide it on product details page, use this code
{% unless template contains "product" %}
{% if product.selected_or_first_available_variant.taxable %}
<span>Price Excl VAT </span>
{% else %}
<span>Price Incl VAT </span>
{% endif %}
{% endunless %}
But it won't show now on any product cards on product pages like "Recently view products"
Please check if it works for you
Thanks!
This is an accepted solution.
What I did is deleted that same code from the main-product.liquid where is the {%if cart.taxes_included %} it seems to done the job not to show anywhere except where the product is set as charge tax on this product . Do you think this change is ok to be done compared to your solution?! Thank you for the help , your answers really helped me a lot in my task.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey 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, 2024