Fix postcode validation within the legacy cart show_shipping method (#51623)
* Postcode should be compared to empty string to prevent `0` passing. * Changelog
This commit is contained in:
parent
536bb4627e
commit
63637c0235
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: fix
|
||||||
|
|
||||||
|
Fix postcode validation within the legacy cart show_shipping method.
|
|
@ -1597,7 +1597,7 @@ class WC_Cart extends WC_Legacy_Cart {
|
||||||
*/
|
*/
|
||||||
$postcode_enabled = apply_filters( 'woocommerce_shipping_calculator_enable_postcode', true );
|
$postcode_enabled = apply_filters( 'woocommerce_shipping_calculator_enable_postcode', true );
|
||||||
$postcode_required = isset( $country_fields['shipping_postcode'] ) && $country_fields['shipping_postcode']['required'];
|
$postcode_required = isset( $country_fields['shipping_postcode'] ) && $country_fields['shipping_postcode']['required'];
|
||||||
if ( $postcode_enabled && $postcode_required && ! $this->get_customer()->get_shipping_postcode() ) {
|
if ( $postcode_enabled && $postcode_required && '' === $this->get_customer()->get_shipping_postcode() ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue