mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-01 11:52:25 +08:00
https://stackoverflow.com/questions/67969213/how-to-prevent-postcode-zip-field-from-getting-hidden-for-some-countries-in-wooc/67971512
16 lines
557 B
Text
16 lines
557 B
Text
function filter_woocommerce_get_country_locale( $country_locale ) {
|
|
// Loop through
|
|
foreach( $country_locale as $key => $locale ) {
|
|
// Isset
|
|
if ( isset ( $locale['postcode']['hidden'] ) ) {
|
|
// When true
|
|
if ( $locale['postcode']['hidden'] == true ) {
|
|
// Set to false
|
|
$country_locale[$key]['postcode']['hidden'] = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
return $country_locale;
|
|
}
|
|
add_filter( 'woocommerce_get_country_locale', 'filter_woocommerce_get_country_locale', 10, 1 );
|