Collecting customers' VAT/TAX numbers in Shopify is important for Legal requirements. As a merchant, you can collect the customers' VAT IDs through either the customer registration or cart pages. Once an order is placed, these details are saved, and our Order Printer Pro templates can display them.
Capture the Customer VAT ID on the customer Registration page (as customer note)
NOTE: The instructions below are helpful if you're using the Classic customer account, which is the one that actually displays a registration page.
You can add a VAT number field to the customer registration form so your customers can input their VAT registration numbers during the setup of their customer accounts in your Shopify store.
You may get the VAT number field to the customer registration page by following these steps:
On Shopify's old themes:
In your Shopify admin, go to Online Store > Themes.
Click the
…
button, then clickEdit code
.Search and select
customers/register.liquid
in the left sidebar.Insert the following code snippet inside the
< form >
and save.
<!-- Shopify Customer Registration to collect customer VAT -->
<label for="vat_number"</label>
<input type="text" name="customer[note][VAT ID]" id="vat_number" class="input-full" placeholder="VAT Number">
Adding the snippet just after the last name field section gives us this result:
On Shopify's newest themes:
In your Shopify admin, go to Online Store > Themes.
Click the
…
button, then clickEdit code
.Search and select
main-register.liquid
in the left sidebar.Insert the following code snippet after one of the input field sections and save.
<!-- Shopify Customer Registration to collect customer VAT -->
<div class="field">
<input
type="text"
name="customer[note][VAT ID]"
id="vat_number"
placeholder="VAT Number"
>
<label for="vat_number"> VAT Number
</label>
</div>
We suggest adding the snippet just after the last name field, and this is the result:
Your customers will be able to input the VAT registration number, and it will be stored as part of the customer notes. Order Printer Pro can then display the customer notes in your templates, as explained in this guide.
💡For more details on adding fields to the customer registration form, please get in touch with Shopify Support and review their official documentation here.
Capture the Customer VAT ID on the cart page (as cart attributes)
You may set a VAT ID field in the cart page so that your customers can enter their VAT registration numbers just before checkout.
To achieve this, you need to add the following code snippet to the cart file in your theme.
To add the Tax ID field to the cart page:
In your Shopify admin, go to Online Store > Themes.
Find the theme you want to edit, and then click Actions > Edit code.
In the Sections directory, click
cart-template.liquid
.
If your theme doesn't have acart-template.liquid
, then trymain-cart-footer.liquid
. If your theme doesn't have it either, then in the Templates directory, findcart.liquid
.Find the closing
</form>
tag in the code.On a new line right above the closing
</form>
tag, paste the code. However, If your theme hasmain-cart-footer.liquid
, then add the snippet on the cart footer section.
<!-- Shopify Shopping Cart attributes to collect customer VAT -->
<p class="cart-attribute__field">
<label for="vat-id">VAT ID</label>
<input id="vat-id" type="text" name="attributes[VAT ID]" value="{{ cart.attributes["VAT ID"] }}">
</p>
That's it! You'll get a result similar to this:
Your customers will now be able to input the VAT registration number, and it will be stored as cart attributes. Order Printer Pro will then display these attributes in your templates, as explained in this guide.
💡For more details on adding fields to the cart page, please get in touch with Shopify Support and review their official documentation here.
Have any questions or need some help? No worries, reach out to our friendly support team!