WooCommerce: Reorder EU VAT field on checkout page

The EU VAT Number extension allows store owners to offer tax-free orders from EU businesses with a valid VAT number. By default, the EU VAT field is placed at the bottom of the billing fields. But what if you want to move that field to another potision?

The plugin adds the VAT number (optional) field below the billing fields as seen in

As a store owner, you might want to reposition the VAT number (optional) field and place it below the company name as seen in

This can be achieved by adding the following code to your site, e.g. using using the Code Snippets plugin:

<?php
/**
 * Reorder EU VAT field on checkout page
 * 
 * @param $fields array The original array with the checkout fields
 * @return $fields array The updated array with the checkout fields
 * @see https://woocommerce.com/products/eu-vat-number/
 */
function smntcs_reorder_eu_vat_field( $fields ) {
	$fields['billing']['billing_vat_number']['priority'] = 35;
	return $fields;
}
add_filter( 'woocommerce_checkout_fields', 'smntcs_reorder_eu_vat_field', 11 );

To move the VAT number field to another position, simply adjust the priority of this field. As the company field has as priority of 30 and the country has a priority of 40, the VAT number field will be positioned between these two fields as its priority is set to 35.

  1. The snippet doesn’t seem to work properly anymore.

    Using the snippet with functions.php it show an input field under the company name field, but without the label text. On top of that it shows the VAT field at the bottom of the checkout with the label field.

    1. Hello Antero, the snippet still works as expected on my end. You might be facing a plugin conflict. Can you deactivate all other plugins except the WooCommerce and the WooCommerce EU VAT Number plugin to test if the snippet works then?

      You are using the official WooCommerce EU VAT Number plugin as seen on https://woocommerce.com/products/eu-vat-number/, right?

Leave a Reply

Your email address will not be published. Required fields are marked *