I already have US selected as my default country in the woocommerce checkout. In addition to that, I was asked to move 'US' to the very top of the country list in the checkout form.
I created a new filter and hooked into 'woocommerce_countries' hook like this:
function change_country_order_in_checkout_form($countries)
{
$countries = array('US' => $countries['US']) + $countries;
return $countries;
}
add_filter( 'woocommerce_countries', 'change_country_order_in_checkout_form' );
My list of countries gets modified correctly, but then something in WooCommerce sorts the countries alphabetically and I want to avoid that. I tried adding:
remove_filter('woocommerce_sort_countries', 'wpautop');
but that did not seem to make any difference. Any help is appreciated.