Hi all
Got a problem that seems simple, but I fail to solve it. Anybody who can help with country array?
Right now the following code is active, which limits the available country to US only, for a certain language/area selection. It works fine. I would now only like to include an additional country (CA) as a choice besides US for the same language/area selection (without changing the language/area selection). If anyone knows the trick pls help.
Existing Code:
if( !function_exists('filter_woocommerce_countries_shipping_countries') ) {
function filter_woocommerce_countries_shipping_countries( $countries ) {
// Filter countries for language
if( function_exists('icl_get_languages') ) {
$current_lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : 'gl_en';
if( isset( $countries['US'] ) ) {
if( $current_lang == 'en' ) {
$countries = array( 'US' => $countries['US'] );
} else {
unset( $countries['US'] );
}
}
}
return $countries;
}
}