Skip to content

Instantly share code, notes, and snippets.

@huypn
Forked from mikejolley/gist:2974310
Created December 9, 2017 23:33
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 huypn/d86141edf2a5f37344f2deb06747a331 to your computer and use it in GitHub Desktop.
Save huypn/d86141edf2a5f37344f2deb06747a331 to your computer and use it in GitHub Desktop.
WooCommerce - Set default state/country for checkout
/**
* Manipulate default state and countries
*
* As always, code goes in your theme functions.php file
*/
add_filter( 'default_checkout_country', 'change_default_checkout_country' );
add_filter( 'default_checkout_state', 'change_default_checkout_state' );
function change_default_checkout_country() {
return 'XX'; // country code
}
function change_default_checkout_state() {
return 'XX'; // state code
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment