Capture VAT numbers on Customer registration page

The VAT number field can be added to the customer registration form. This will allow your customers to enter their VAT registration numbers when they set up their customer accounts in your store.

Shopify Customer Registration page VAT Number

Example of a Customer Registration form with the VAT number field

VAT numbers will be stored as part of customer notes. Sufio will automatically validate these VAT numbers and set business customers as tax exempt when applicable. Customer VAT numbers will also be included on your invoices.

To add the VAT number field to the customer registration page:  

  1. Go to the page Online Store → Themes in your Shopify store admin.
  2. Click the Actions button, then click Edit code
  3. Select customers/register.liquid in the left sidebar.
  4. Insert the following code snippet inside the <form>. A good place for the field is before the Email field.

<!-- Shopify customer registration -- capture VAT numbers from customers. Used by Sufio for Shopify (www.sufio.com/shopify). -->
<label for="vat_reg_no">VAT Registration Number</label>
<input id="vat_reg_no" type="text" name="customer[note][VAT Registration Number]" placeholder="VAT Registration Number" />

  1. Select index.liquid in the left sidebar. 
  2. Insert the following code snippet at the end of thi file.

<!-- Shopify customer account -- set business customers as VAT exempt when applicable. Used by Sufio for Shopify (www.sufio.com/shopify). -->
<script type="text/javascript">
  function getCookieValue(a) { var b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)'); return b ? b.pop() : ''; }
  
  var email = "{{ customer.email }}";
  document.addEventListener("DOMContentLoaded", function(event) {
    if (getCookieValue("sufio_vat_email_init") != email) {
      document.cookie = "sufio_vat_email_init="+email+";expires=Tue, 31 Dec 2030 00:00:00 GMT;path=/";
      $.ajax({
        type : "GET",
        dataType: "jsonp",
        url: "/apps/sufio/customer-vat/",
        data: { email: email }
      }); 
    }
  });
</script>

Required customer accounts

If your store has customer accounts set as "required", some extra steps are needed in addition to those mentioned above:

  1. Select customers/register.liquid in the left sidebar. 
  2. Insert the following code snippet inside the <form>.
<!-- Shopify redirect -- redirect new user with items in the cart to cart after registration. Used by Sufio for Shopify (www.sufio.com/shopify). -->
{% if cart.item_count > 0 %}
  <input type="hidden" name="return_to" value="/cart" />
{% endif %}

  1. Select cart.liquid in the left sidebar.
  2. Insert the following code snippet at the end of this file.

<!-- Shopify customer account -- set business customers as VAT exempt when applicable. Used by Sufio for Shopify (www.sufio.com/shopify). -->
<script type="text/javascript">
  function getCookieValue(a) { var b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)'); return b ? b.pop() : ''; }
  
  var email = "{{ customer.email }}";
  document.addEventListener("DOMContentLoaded", function(event) {
    if (getCookieValue("sufio_vat_email_init") != email) {
      document.cookie = "sufio_vat_email_init="+email+";expires=Tue, 31 Dec 2030 00:00:00 GMT;path=/";
      $.ajax({
        type : "GET",
        dataType: "jsonp",
        url: "/apps/sufio/customer-vat/",
        data: { email: email }
      }); 
    }
  });
</script>

Note

Please note that to make VAT exemptions work, you need to enable the VAT exemptions feature in your Sufio account

Need help?

Do you need help with updating your store theme? Contact one of our Shopify Expert partners who will be happy to assist you.