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:
Seghir Nadir 2024-08-23 17:34:57 +02:00 committed by GitHub
parent 524a7202e6
commit e66ccf698c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View File

@ -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"

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Make Checkout block `coupons` filter consistent by always running.