Last active
October 23, 2018 08:34
-
-
Save conschneider/366bbe4508715894b3d5e1f16200d917 to your computer and use it in GitHub Desktop.
Makes the state field in WooCommerce checkout always required.
This file contains 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
/* https://www.mootpoint.org/blog/woocommerce-make-uk-county-field-required/ for an excellent description on why this filter. */ | |
add_filter( 'woocommerce_get_country_locale', 'mp_change_locale_field_defaults'); | |
function mp_change_locale_field_defaults($countries) { | |
//swap 'RO' for your country ID. | |
$countries['RO']['state']['required'] = true; | |
//set custom field label | |
$countries['RO']['state']['label'] = ''; | |
return $countries; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment