File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
packages/react/src/components/checkout/payment/checkout-buttons/express Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ export function ExpressCheckoutButton() {
331331
332332 useEffect ( ( ) => {
333333 if ( ! draftOrder ) return ;
334- // Prevent concurrent fetches
334+ // Prevent concurrent fetches (but allow new fetches when draft order changes)
335335 if ( couponFetchStatus === 'fetching' ) return ;
336336
337337 const fetchPriceAdjustments = async ( ) => {
@@ -364,7 +364,7 @@ export function ExpressCheckoutButton() {
364364
365365 const discountCodes = Array . from ( allCodes ) ;
366366
367- // Update state based on what's in the draft order
367+ // Update refs based on what's in the draft order
368368 if ( discountCodes ?. length && discountCodes ?. [ 0 ] ) {
369369 const result = await getPriceAdjustments . mutateAsync ( {
370370 discountCodes : [ discountCodes ?. [ 0 ] ] ,
@@ -559,6 +559,10 @@ export function ExpressCheckoutButton() {
559559 setCouponFetchStatus ( 'idle' ) ;
560560 setCalculatedTaxes ( null ) ;
561561
562+ // Clear coupon refs - will be re-synced with draft order on next fetch
563+ appliedCouponCodeRef . current = null ;
564+ calculatedAdjustmentsRef . current = null ;
565+
562566 // Clear any error messages
563567 setError ( '' ) ;
564568
You can’t perform that action at this time.
0 commit comments