I customized the code below and it is applying the required field, but it is optional again. I have uploaded the gif file with the behavior: https://gifyu.com/image/Sh5wM
add_filter( 'woocommerce_billing_fields', 'checkout_billing_fields', 9999 );
add_filter( 'woocommerce_shipping_fields', 'checkout_shipping_fields' , 9999 );
function checkout_billing_fields( $fields ) {
if ( is_checkout() ) {
if ( isset( $fields['billing_neighborhood'] ) ) {
$fields['billing_neighborhood']['required'] = true;
}
}
return $fields;
}
function checkout_shipping_fields( $fields ) {
if (is_checkout() ) {
if ( isset( $fields['shipping_neighborhood'] ) ) {
$fields['shipping_neighborhood']['required'] = true;
}
}
return $fields;
}