This page was printed on Jan 22, 2021. For the current version, visit https://help.shopify.com/en/manual/checkout-settings/script-editor/examples/vat-script.
This example uses a line-item script to offer a discount that's based on the country of the customer. The example also includes example Liquid code to provide information to the customer about the discount. This example requires that you have access to your store's checkout.liquid file. If you don't have access to this file in your theme code, then contact Shopify Plus Support to gain access.
This example uses a fictional VAT tax that has the following rules:
Customers who reside in a union of countries are charged VAT taxes on all products sold.
Customers who purchase products and have them exported to non-union country do not have to pay the VAT tax (in other words, sales to these customers are zero-rated).
Prices of products in the store include the VAT tax (that is All taxes are included in my prices setting is enabled for the store's tax settings.
In the storefront, all customers see the VAT included in the prices of products. When items are added to the cart, the VAT included price is shown:
At checkout, the shipping country is checked by the script. If the country is a non-union country, then the total price is reduced by the amount of the VAT:
In the following example, the country of the customer is checked. If the customer lives in a country where the VAT does not apply, then the total price of the order is reduced by the VAT amount.
The following Liquid code works with the above script to explain the changes in the cart.