Prevent the postcode zip field from being hidden for countries in WooCommerce

Prevent the postcode zip field from being hidden for countries in WooCommerce on child sites.

Snippet Type

Execute on Child Sites

Snippet

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 );

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.