Merge pull request #27633 from woocommerce/fix/27618
Allow zero as variation attribute option
This commit is contained in:
commit
226225e0da
|
@ -1040,7 +1040,6 @@ class WC_Cart extends WC_Legacy_Cart {
|
|||
|
||||
// Gather posted attributes.
|
||||
$posted_attributes = array();
|
||||
|
||||
foreach ( $parent_data->get_attributes() as $attribute ) {
|
||||
if ( ! $attribute['is_variation'] ) {
|
||||
continue;
|
||||
|
@ -1056,7 +1055,7 @@ class WC_Cart extends WC_Legacy_Cart {
|
|||
}
|
||||
|
||||
// Don't include if it's empty.
|
||||
if ( ! empty( $value ) ) {
|
||||
if ( ! empty( $value ) || '0' === $value ) {
|
||||
$posted_attributes[ $attribute_key ] = $value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2248,7 +2248,7 @@ class WC_Tests_Cart extends WC_Unit_Test_Case {
|
|||
|
||||
// Attempt adding variation with add_to_cart_action, without specifying attribute_pa_colour.
|
||||
$_REQUEST['add-to-cart'] = $variation['variation_id'];
|
||||
$_REQUEST['attribute_pa_number'] = '0';
|
||||
$_REQUEST['attribute_pa_number'] = '';
|
||||
WC_Form_Handler::add_to_cart_action( false );
|
||||
$notices = WC()->session->get( 'wc_notices', array() );
|
||||
|
||||
|
|
Loading…
Reference in New Issue