Calculate price without taxes on invoice

Ivan_Komorcec
New Member
7 0 0

Hi all, 

because of the law in my country, I need to show my prices with tax (VAT 25%) included in my webshop. So, I thought no problem, I just checked "All taxes are included in my prices" on the settings page.

Now, problem is that according to the same law, I need to send a invoice to my customer, and on that invoice, I need to show also prices without taxes. 

How can I configure Order Printer to do this? I already have "Price with tax" and "amount of tax" but I can't get to show "price with tax minus amount of tax" as separate column. I spent days trying to figure it out. Can somebody please help me?

0 Likes
dav-mcg
Shopify Staff
Shopify Staff
103 0 29

Hey Ivan,

David here, Shopify Guru!

To include the "Price without tax" you can use the liquid variable 

{{ subtotal_price | minus: tax_price | money }} 

 which subtracts the tax price from the subtotal price.

Therefore if you would like to display this in the Payment Details section of the invoice:

You can just add this code in your template editor:

Hope that helps, feel free to drop us a line at support@shopify.com if you have any other questions. 

David Mc | Shopify Guru

0 Likes
Ivan_Komorcec
New Member
7 0 0

Thanks, it worked like a charm. Previously I used total_price instead of subtotal_price.

 

Thanks again!

 

Edit: Well, I think I was maybe not perfectly clear, I need to show the price of every item without tax, not just subtotal. This solution works when I have only one item, but not when I have several items :(

0 Likes
dav-mcg
Shopify Staff
Shopify Staff
103 0 29

Hey Ivan,

David here again!

Okay so if you would like the price without tax of every item you could include this in Item Details as opposed to the total price without tax in the Payment Details above.

This involves a bit more coding as it requires a loop for the tax_lines:

{% if line_item.tax_lines %}
          <td>
            {% for tax_line in line_item.tax_lines %}
              {{ line_item.price | minus: tax_line.price | money }}<br/>
            {% endfor %}
          </td>
{% endif %}

This snippet outputs the products's price minus the taxes paid on this product!

So if you setup the table like this:

You will get something like this:

I will leave the Croatian translations to you but that should work!

Hope that's okay :)

David Mc | Shopify Guru

0 Likes
Ivan_Komorcec
New Member
7 0 0

Thank you David! You made my life easier :)

0 Likes
keepselling_not
Shopify Partner
2 0 0

Hi guys, is there any way to implement this snippet of code in the check out page's additional script input?

0 Likes
naturalshop_ie
New Member
4 0 0

Hi David,

Thanks for this solution but it works well only when there is only one item in the line but if product is x2 or more it doesn't work the same and the price in invoice decrease with products quantity increase.

Price of each of items in the invoice is € 3.01 so without Tax it should be € 2.45 but in the lines with 4 products price is € 0.76 and in the rows with 2 products the price is € 1.88

 

 

 

Do you have an idea how to fix it?

Thanks,

Lukasz

0 Likes
Gregory7
New Member
2 0 0

Dear David Mc,

Could you please let me know how I can include this into my Order Printer Templates HTML Code ?

Best Regards,

Gregory

0 Likes
Rich_Woodward
Shopify Partner
6 0 4

Hopefully this will answer why tax_line.price cannot be used here. 

 

The 'tax_line.price' in liquid is the tax percentage in Shopify Settings applied to the product price. This is fine when showing the tax of product prices which exclude tax, but it cannot be used for product prices which include tax.

 

For example, if tax is 20% and the retail price (including tax) is £100, the 'tax_line.price' returns £20. This is NOT the tax amount of a retail product of £100. The tax at 20% of a product price retailing at £100 (including tax) should be £16.67. The price of this product excluding tax is £83.33.  It is necessary to find out the price excluding Tax manually, but this is fairly simple using liquid.

 

In the UK, VAT is 20%. So the price of a product excluding VAT can be calculated by dividing the retail price by 1.2. 

 

£100 divided by 1.2 is £83.33. The value of VAT is 20% of £83.33 (not of £100).  20% of £83.33 is £16.67 - added together you get the retail price of £100.

 

This works for other tax values - if tax is 23% then you divide the retail price by 1.23 to get the price excluding tax.

 

So, if your prices in Shopify are set up to include tax, you can use the following to get the price excluding tax.

 

{% assign price_ex_tax = line_item.original_price | divided_by: 1.2 %}

 

Then you can use {% price_ex_tax | money %}  to show your retail price excluding tax in Order Printer invoices or within Shopify pages. 

 

This is just a simple example - if you have discounts, or want to calculate the ex. tax price of totals, please refer to Shopify's excellent liquid reference pages (Google search 'shopify liquid objects'). 

 

 

 

Simoncello
Shopify Partner
13 0 0

Your solution sounds interesting. However without some hard code most people here will probably not understand how to implement your suggestion, including me

0 Likes