In Woocommerce, I am keeping prices the same regardless of tax rate using the filter:
add_filter('woocommerce_adjust_non_base_location_prices', '__return_false');
Now, I'd like to exclude a few countries that are exempt of tax.
This function works fine:
add_filter( 'woocommerce_adjust_non_base_location_prices', 'custom_eu_vat_number_country_codes' );
function custom_eu_vat_number_country_codes( $boolean ) {
// Avoiding errors on admin and on other pages
if( is_admin() || WC()->cart->is_empty() )
return $boolean;
// Defined array of countries where the boolean value should be "false"
$countries = array( 'CH','GB','GF','NO','UK');
// Remove field $countries
if ( in_array( WC()->customer->get_shipping_country(), $countries ) ) {
$boolean = true;
}else{
$boolean = false;
}
return $boolean;
}
I need to replace $countrie = array('CH','GB','GF','NO','UK'); by an automatic list of countries with VAT tax set as 0.000% in woocommerce parameters. Is it possible ?