Merge pull request #25386 from woocommerce/fix/is_package_shippable
Make WC_Shipping::is package shippable less strict
This commit is contained in:
commit
4c39f81f12
|
@ -294,12 +294,7 @@ class WC_Shipping {
|
|||
}
|
||||
|
||||
$states = WC()->countries->get_states( $country );
|
||||
if ( is_array( $states ) && ! isset( $states[ $package['destination']['state'] ] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$postcode = wc_format_postcode( $package['destination']['postcode'], $country );
|
||||
if ( ! WC_Validation::is_postcode( $postcode, $country ) ) {
|
||||
if ( is_array( $states ) && ! empty( $states ) && ! isset( $states[ $package['destination']['state'] ] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,19 +60,6 @@ class WC_Tests_Shipping extends WC_Unit_Test_Case {
|
|||
);
|
||||
$this->assertFalse( $result );
|
||||
|
||||
// Failure for invalid postcode.
|
||||
$result = $shipping->is_package_shippable(
|
||||
array(
|
||||
'destination' => array(
|
||||
'country' => 'US',
|
||||
'state' => 'CA',
|
||||
'postcode' => 'test',
|
||||
'address' => '',
|
||||
),
|
||||
)
|
||||
);
|
||||
$this->assertFalse( $result );
|
||||
|
||||
// Success for correct address.
|
||||
$result = $shipping->is_package_shippable(
|
||||
array(
|
||||
|
|
Loading…
Reference in New Issue