Reorder Countries
-
Hi There,
OK I am trying to reorder countries following several examples online. I can run the following fine :-
add_filter( 'woocommerce_countries', 'wc_custom_countries_order', 10, 1 ); function wc_custom_countries_order( $countries ) { // replace with iso code of the country (example: US or GB) unset($countries['GG']); unset($countries['JE']); unset($countries['GB']); // replace with iso code of country AND country name (example: US | United States or GB | United Kingdom (UK) $countries = ['GB' => 'Mainland - United Kingdom'] + ['JE' => 'Jersey - United Kingdom'] + ['GG' => 'Guernsey - United Kingdom'] + $countries; return $countries; }This works and on output and I kill the script it looks good. However if I let it load the order is still as was. I have tried adding the following :-
add_filter('woocommerce_sort_countries', '__return_false');However this does not work either. It is like the initial code works for reordering but then something is happening after this to order by the order of countries set in the backend or something? I feel there must be something simple as everyone seems to have solutions that no longer works.
Woo is up to date and this is a bespoke theme so nothing special is in place.
Cheers
J
The topic ‘Reorder Countries’ is closed to new replies.