Last active
April 7, 2020 20:56
-
-
Save webdados/ee14ec6aa3ab6be1b89de7725ede7379 to your computer and use it in GitHub Desktop.
Workaround for WooCommerce get_european_union_countries( 'eu_vat' ) after WooCommerce 4.0.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//See here why this is needed: https://github.com/woocommerce/woocommerce/issues/26105 | |
function woocommerce_get_european_union_countries_after_wc4( $type = '' ) { | |
$countries = WC()->countries->get_european_union_countries(); | |
if ( 'eu_vat' === $type ) { | |
$countries[] = 'MC'; | |
$countries[] = 'IM'; | |
$countries[] = 'GB'; //Great Britain is still part of the EU VAT zone | |
} | |
return $countries; | |
} | |
//Usage to get the EU countries | |
$countries = woocommerce_get_european_union_countries_after_wc4(); | |
//Usage to get the countries that are part of the EU VAT zone | |
$eu_vat_countries = woocommerce_get_european_union_countries_after_wc4( 'eu_vat' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment