Example: Set city, state, postcode optional
add_filter( 'woocommerce_get_country_locale_base', 'custom_woocommerce_get_country_locale_base', 11, 1 );
function custom_woocommerce_get_country_locale_base( $locale ) {
return array(
'state' => array(
'required' => false,
'hidden' => true,
),
'city' => array(
'required' => false,
'hidden' => true,
),
'postcode' => array(
'required' => false,
'hidden' => true,
),
);
}