Skip to content

Instantly share code, notes, and snippets.

@rynaldos
Last active November 2, 2021 03:35
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 rynaldos/5000e16fb8b331a035d83f453d8d8591 to your computer and use it in GitHub Desktop.
Save rynaldos/5000e16fb8b331a035d83f453d8d8591 to your computer and use it in GitHub Desktop.
Add England, Wales, Scotland, and Northern Ireland to WooCommerce shipping zones
add_filter( 'woocommerce_countries', 'rs_add_my_country' );
function rs_add_my_country( $countries ) {
$new_countries = array(
'NIRE' => __( 'Northern Ireland', 'woocommerce' ),
'SCO' => __( 'Scotland', 'woocommerce' ),
'WAL' => __( 'Wales', 'woocommerce' ),
'ENG' => __( 'England', 'woocommerce' ),
);
return array_merge( $countries, $new_countries );
}
add_filter( 'woocommerce_continents', 'rs_add_my_country_to_continents' );
function rs_add_my_country_to_continents( $continents ) {
$continents['EU']['countries'][] = 'NIRE';
$continents['EU']['countries'][] = 'SCO';
$continents['EU']['countries'][] = 'WAL';
$continents['EU']['countries'][] = 'ENG';
return $continents;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment