Skip to content

Instantly share code, notes, and snippets.

@manojmohangit
Last active March 2, 2018 06:15
Show Gist options
  • Save manojmohangit/29f319557712cf6f09dfd228cb10b52e to your computer and use it in GitHub Desktop.
Save manojmohangit/29f319557712cf6f09dfd228cb10b52e to your computer and use it in GitHub Desktop.
Set the default country on the checkout in Woocommerce 3.0+
add_filter('default_checkout_billing_country', 'change_default_checkout_country');
function change_default_checkout_country($county_code) {
return empty($county_code) ? 'XX' : $county_code ; // 'XX' is the default country code if there is no country code passed on to the filter (if user has saved billing country).
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment