Created
May 12, 2021 10:30
-
-
Save wbcomdev/95f494886ee1ad839d3f7578fcf990b2 to your computer and use it in GitHub Desktop.
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
| /** | |
| * Change the default country on the checkout for non-existing users only. | |
| */ | |
| function wb_change_default_checkout_country( $country ) { | |
| // If the user already exists, don't override country | |
| if ( WC()->customer->get_is_paying_customer() ) { | |
| return $country; | |
| } | |
| return 'DE'; // Override default to Germany (an example) | |
| } | |
| add_filter( 'default_checkout_billing_country', 'wb_change_default_checkout_country', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment