Plugin to Add Custom Tax/VAT Field On WooCommerce Checkout

woocommerce VAT cF

A while back I did an shop on WooCommerce and I needed to add the tax id on the checkout page and also to be displayed in the order page or in the email. There are a few tutorials over the internet that can help you with this even an paid plugin if you want validation and more advance configuration features. The below tutorials have been used to build a plugin that is inserting a Vat field in the checkout page of WooComerce and also is displaying it in the order page:

Because there is the risk that the code to be deleted if I implement it directly in the WooCommerce I preferred to create a plugin. In this way I avoid losing the field when the plugin is created. Creating the plugin is not to hard and it is also clean. Below is the code that I have used to add the field in the checkout:


add_filter( 'woocommerce_checkout_fields' , array( $this,'VAT_override_checkout_fields' ));

	public function VAT_override_checkout_fields( $fields ) {
				$fields['billing']['VAT_cui'] = array(
				'label'     => __('VAT', 'woocommerce'),
				'placeholder'   => _x('VAT', 'placeholder', 'woocommerce'),
				'required'  => true,
				'class'     => array('form-row-wide'),
				'clear'     => true

				return $fields;

Below is the code to add the code in the order page:

add_action( 'woocommerce_admin_order_data_after_billing_address',  array( $this,'VAT_custom_checkout_field_order_meta_keys' );
	public function VAT_custom_checkout_field_order_meta_keys( $order ) {
		echo "<p><strong>VAT:</strong>" .
		$order->order_custom_fields['_VAT_cui'][0] . "</p>";


The script an plugin doesn’t update the user meta it is only inserting the VAT in the order. Every time when an new command will be made the filed will be there together with the VAT and if the customer would want to change it it can be changed.

Below is the plugin that can be used to add the VAT mandatory custom field in the checkout page of Woocommerce, it can be installed like any other plugin but to work be sure that WooCommerce plugin is installed.

To download it just the article with one of the below links.




== Installation ==

1. Upload the entire ‘woocommerce-VAT’ folder to the ‘/wp-content/plugins/’ directory
2. Activate the plugin through the ‘Plugins’ menu in WordPress

== Changelog ==

= 1.0.0 =
* Initial Release


  1. pretty cool your plugin, thanks a lot.
    unfortunately i get an error in woocommerce -> orders -> orderdetail: Fatal error: Cannot use string offset as an array in /pathtowoocommerce/wp-content/plugins/woocommerce-vat-checkout-add/woocommerce-vat.php on line 66

  2. i fixed it:

    public function VAT_custom_checkout_field_order_meta_keys( $order ) {
    $my_order_meta = get_post_custom( $order->id );
    echo "UmsatzsteuerID: ".$my_order_meta['_VAT_cui'][0]."";

  3. Hi.
    I put this plugin and activate it.
    In the check out process can write the vat number.
    After, this vat number doesnt appears in orders, emails, etc..

    do you know why?

    Thank you.

  4. I noticed that in the last version of woocommerce, this plugin doesn’t work at all. As @sergio pointed, in the order page the VAT doesn’t appear… Is there any compatibility issues? Thanks!

  5. Hi,

    with woocommerce 2.2.6 the VAT field is visible on checkout but on the order view in woocommerce and on hte email that you receive with the order it is not shown.



Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.