Last active
July 2, 2020 05:22
-
-
Save rynaldos-zz/810b70068c087b7abc788b0b2541c546 to your computer and use it in GitHub Desktop.
[WooCommerce 3.0+] Change the default state and country on the checkout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
// Did this help? Donate me some BTC: 1BEsm8VMkYhSFJ92cvUYwxCtsfsB2rBfiG |
any update for 'SHIP TO A DIFFERENT ADDRESS?' default country set?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add a condition to the function, to check if the user already exists, like so:
Cheers!