Created
June 22, 2012 18:13
-
-
Save mikejolley/2974310 to your computer and use it in GitHub Desktop.
WooCommerce - Set default state/country for 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
/** | |
* 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 | |
} |
Is there anyway to replace 'Select an option' with a state name from woocommerce checkout page (billing_state field). Also needed to show other STATES when click the select box.
(I wanted to set a default state in checkout form and other states will only when click the drop down select box.)
Anyway we get the location based on geolocation?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great its Working :)