Re: Addressing only products with ticket charge tax on this product

Solved

Addressing only products with ticket charge tax on this product

Hushhush
Excursionist
15 1 3

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 ! 

Accepted Solutions (2)
pawankumar
Shopify Partner
644 95 119

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!

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan

View solution in original post

Hushhush
Excursionist
15 1 3

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. 

View solution in original post

Replies 7 (7)

pawankumar
Shopify Partner
644 95 119

Hi @Hushhush 
You can use an if statement like this

{% if product.selected_or_first_available_variant.taxable %}

Write your code here

{% endif %}

Thanks!

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan
Hushhush
Excursionist
15 1 3

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 

Hushhush
Excursionist
15 1 3

Maybe I need to add that I am putting the code in the price.liquid file too . Using Dawn theme 

pawankumar
Shopify Partner
644 95 119

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!

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan
Hushhush
Excursionist
15 1 3

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 

pawankumar
Shopify Partner
644 95 119

It should show only once like this

pawankumar_0-1714407263775.png

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!

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan
Hushhush
Excursionist
15 1 3

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.