Last active
July 15, 2021 12:17
-
-
Save jorpdesigns/9beadf5238eb76374ecd4f8cf448a8f8 to your computer and use it in GitHub Desktop.
Snippet to add Northern Ireland to WooCommerce countries list
This file contains hidden or 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 | |
// ADD NEW COUNTRY | |
add_filter( 'woocommerce_countries', 'custom_country_nothern_ireland' ); | |
function custom_country_nothern_ireland( $countries ) { | |
$new_countries = array( 'NIRE' => __( 'Northern Ireland', 'woocommerce' ), ); | |
return array_merge( $countries, $new_countries ); | |
} | |
// ADD NEW COUNTRY UNDER CONTINENT | |
add_filter( 'woocommerce_continents', 'add_nothern_ireland_to_continents' ); | |
function add_nothern_ireland_to_continents( $continents ) { | |
$continents['EU']['countries'][] = 'NIRE'; | |
return $continents; | |
} | |
// RENEAME UNITED KINGDOM | |
add_filter( 'woocommerce_countries', 'rename_uk' ); | |
function rename_uk( $countries ) { | |
$countries['GB'] = 'United Kingdom (excl. Northern Ireland)'; | |
return $countries; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment