Allow removing postcode and state from calculator even if required
Allow removing postcode and state fields from the shipping calculator, if they're not needed for calculation, even if they're required at the checkout. Fixes #28393
This commit is contained in:
parent
0a11d03ce5
commit
350e703704
|
@ -1573,10 +1573,10 @@ class WC_Cart extends WC_Legacy_Cart {
|
|||
return false;
|
||||
}
|
||||
$country_fields = WC()->countries->get_address_fields( $country, 'shipping_' );
|
||||
if ( isset( $country_fields['shipping_state'] ) && $country_fields['shipping_state']['required'] && ! $this->get_customer()->get_shipping_state() ) {
|
||||
if ( apply_filters( 'woocommerce_shipping_calculator_enable_state', true ) && isset( $country_fields['shipping_state'] ) && $country_fields['shipping_state']['required'] && ! $this->get_customer()->get_shipping_state() ) {
|
||||
return false;
|
||||
}
|
||||
if ( isset( $country_fields['shipping_postcode'] ) && $country_fields['shipping_postcode']['required'] && ! $this->get_customer()->get_shipping_postcode() ) {
|
||||
if ( apply_filters( 'woocommerce_shipping_calculator_enable_postcode', true ) && isset( $country_fields['shipping_postcode'] ) && $country_fields['shipping_postcode']['required'] && ! $this->get_customer()->get_shipping_postcode() ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue