Skip to content

Commit b4f2440

Browse files
refetch coupon code state on close wallet
1 parent 13e1fe9 commit b4f2440

File tree

1 file changed

+6
-2
lines changed
  • packages/react/src/components/checkout/payment/checkout-buttons/express

1 file changed

+6
-2
lines changed

packages/react/src/components/checkout/payment/checkout-buttons/express/godaddy.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)