Run Checkout block coupon filter on empty array (#50876)
* Run Checkout block coupon filter on empty array * fix conditional * Add changefile(s) from automation for the following project(s): woocommerce-blocks * remove useless eslint skip --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
524a7202e6
commit
e66ccf698c
|
@ -49,7 +49,13 @@ const TotalsDiscount = ( {
|
||||||
} = values;
|
} = values;
|
||||||
const discountValue = parseInt( totalDiscount, 10 );
|
const discountValue = parseInt( totalDiscount, 10 );
|
||||||
|
|
||||||
if ( ! discountValue && cartCoupons.length === 0 ) {
|
const filteredCartCoupons = applyCheckoutFilter( {
|
||||||
|
arg: filteredCartCouponsFilterArg,
|
||||||
|
filterName: 'coupons',
|
||||||
|
defaultValue: cartCoupons,
|
||||||
|
} );
|
||||||
|
|
||||||
|
if ( ! discountValue && filteredCartCoupons.length === 0 ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,12 +67,6 @@ const TotalsDiscount = ( {
|
||||||
? discountValue + discountTaxValue
|
? discountValue + discountTaxValue
|
||||||
: discountValue;
|
: discountValue;
|
||||||
|
|
||||||
const filteredCartCoupons = applyCheckoutFilter( {
|
|
||||||
arg: filteredCartCouponsFilterArg,
|
|
||||||
filterName: 'coupons',
|
|
||||||
defaultValue: cartCoupons,
|
|
||||||
} );
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TotalsItem
|
<TotalsItem
|
||||||
className="wc-block-components-totals-discount"
|
className="wc-block-components-totals-discount"
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: fix
|
||||||
|
|
||||||
|
Make Checkout block `coupons` filter consistent by always running.
|
Loading…
Reference in New Issue