Make VAT field not required
Saturday, 23 November 2019
WooCommerce B2B, among its features, adds VAT number field in checkout page form and in registration form (if “Extended registration form” option is enabled).
This field is mandatory, as required in most B2B stores.
But in some cases, you may want the VAT field to be optional, such as in stores that have both B2B and B2C.
To do this, edit functions.php file that you find in your site’s FTP space in:
wp-content/themes/{YOUR_ACTIVE_THEME}/functions.php
and insert this code:
add_filter( 'woocommerce_billing_fields' , function( $fields ) { $fields['billing_vat']['required'] = false; return $fields; } );
It is advisable not to edit the theme files directly, but to use a child theme.
For more information on child themes, please read: WordPress Official guide on Child Themes