Skip to content

fix: prevent delivery method flipping on address change#1407

Merged
wcole1-godaddy merged 1 commit into
mainfrom
fix-delivery-method-flip-on-address-change
Jul 8, 2026
Merged

fix: prevent delivery method flipping on address change#1407
wcole1-godaddy merged 1 commit into
mainfrom
fix-delivery-method-flip-on-address-change

Conversation

@pbennett1-godaddy

Copy link
Copy Markdown
Collaborator

Summary

Fixes a checkout delivery-method regression when both enableLocalPickup and enableShipping are enabled.

Previously, if a shopper selected local pickup first, causing a pickup fulfillment location to be applied, then switched to shipping and entered a shipping address, a draft-order refetch could
rehydrate deliveryMethod from the order’s line-item fulfillment mode. Because the order still looked like pickup at that moment, the UI could flick back from shipping to local pickup.

This change prevents draft-order refetch hydration from overwriting the shopper’s explicit delivery-method selection while still allowing the delivery method form to default/correct the method when
only one delivery option is available.

Changeset

  • Changeset added (docs)

Test Plan

Added regression and edge-case coverage for delivery-method stability during draft-order sync/refetch flows:

  • Keeps shipping selected when a shipping address sync refetches a prior pickup order.
  • Keeps pickup selected when a draft-order refetch still looks like shipping.
  • Keeps shipping selected when a stale pickup refetch arrives during delivery-method switching.
  • Defaults to pickup when shipping is disabled and the order-derived method is shipping.
  • Defaults to shipping when pickup is disabled and the order-derived method is pickup.
  • Keeps an explicit delivery selection across mixed-fulfillment refetches.
  • Confirms as shipping after pickup-to-shipping address sync/refetch, ensuring no pickup fulfillment fields are sent.

Validated with:

pnpm --filter @godaddy/react test -- checkout-draft-order-sync.test.tsx                                                                                                                                 
pnpm --filter @godaddy/react typecheck                                                                                                                                                                  

@pbennett1-godaddy pbennett1-godaddy requested a review from a team as a code owner July 8, 2026 16:00
@changeset-bot

changeset-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a056ca9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@godaddy/react Patch
nextjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@wcole1-godaddy wcole1-godaddy merged commit 5c6df26 into main Jul 8, 2026
3 checks passed
@wcole1-godaddy wcole1-godaddy deleted the fix-delivery-method-flip-on-address-change branch July 8, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants