Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webdados/ee14ec6aa3ab6be1b89de7725ede7379 to your computer and use it in GitHub Desktop.
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
<?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