Skip to content

Instantly share code, notes, and snippets.

@woogists
Last active May 28, 2021 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woogists/8f2adf6a0e7a4e456c8f07900697f9e3 to your computer and use it in GitHub Desktop.
Save woogists/8f2adf6a0e7a4e456c8f07900697f9e3 to your computer and use it in GitHub Desktop.
[Frontend Snippets] Change the default state and country on the checkout
/**
* Change the default state and country on the checkout page
*/
add_filter( 'default_checkout_billing_country', 'change_default_checkout_country' );
add_filter( 'default_checkout_billing_state', 'change_default_checkout_state' );
function change_default_checkout_country() {
return 'XX'; // country code
}
function change_default_checkout_state() {
return 'XX'; // state code
}
@pdfrequest3
Copy link

is this still working?

@jsmusiker
Copy link

This appears to not be working anymore after the latest WC updates. Can we please get a update to this Code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment