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. calcaneus August 13, 2014
    2. calcaneus August 13, 2014
      • admin September 2, 2014
    3. Sergio September 24, 2014
    4. Manuel October 9, 2014
      • admin October 11, 2014
    5. elies pavlou October 14, 2014
    6. Brad May 2, 2016

    Add Your Comment