Repository navigation
fix(checkout) Default to free shipping when a free rate is available - #1505
Merged
wcole1-godaddy merged 5 commits intoOct 20, 2026
Merged
wcole1-godaddy merged 5 commits into
wcole1-godaddy merged 5 commits into
Conversation
🦋 Changeset detectedLatest commit: f3ea791 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
sbolinger-godaddy
approved these changes
Oct 15, 2026
sbolinger-godaddy
left a comment
Collaborator
There was a problem hiding this comment.
Nothing major found, approving. A couple of small non-blocking notes below.
What I validated:
- Read the diff along with the existing
ShippingMethodFormeffect,shouldApplyShippingMethod, andfilterAndSortShippingMethods. The free rate only wins when the shopper hasn't picked a rate. A $0 rate already on the order is kept, so there's no extra apply. The free-shipping minimum-order rule still filters $0 rates before this logic runs. - A failed free-rate apply doesn't retry in a loop, because the processed state still holds the free rate. The click error path also restores the previous selection.
- In checkout-api, there's no server-side default shipping line, so a paid line on the order at load always came from the client. That fits the explanation of the bug.
- The GoDaddy express wallet sends its shipping lines in the confirm request rather than changing the draft order, so this change doesn't override a wallet choice.
vitest run src/components/checkoutinpackages/react: 741 passed.
Non-blocking:
- The changeset says a pick is kept "for the rest of the checkout visit," but switching from Shipping to Local pickup and back also drops it.
mainbehaves the same, since switching to pickup clears the shipping line, so it isn't a regression. Rewording the changeset would make it accurate. - If product wants a paid pick to survive a payment-redirect return, saving the clicked rate in
sessionStorage(keyed by session ID) would be a cheap follow-up.
The shipping method effect kept any already-applied rate that was still listed, so a paid rate that was auto-applied or already on the draft order won over a $0 rate. Prefer the shopper's explicit pick from this mount, then a $0 rate, then the existing behavior. AIROBUILD-7255 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prefer a $0 rate already on the draft order over another $0 rate that sorts first, so no extra apply is sent. When the auto-apply of a free rate fails, show the rate the draft order still has instead of leaving the free radio checked. AIROBUILD-7255 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pickup Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anam-godaddy
force-pushed
the
fix/AIROBUILD-7255-free-shipping-default
branch
from
October 16, 2026 17:08
1ff03da to
a33afd2
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wcole1-godaddy
approved these changes
Oct 20, 2026
wcole1-godaddy
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Merged main in (no conflicts); react typecheck + all tests pass locally.
Non-blocking notes:
- Resetting the shopper's paid choice on reload is a reasonable trade-off given the draft order can't tell an auto-applied rate from a picked one, and it's called out in the changeset.
shipping-method.tsx: the free check usescost?.value === 0whilefilterAndSortShippingMethodssorts withcost?.value || 0, so a rate with no cost would sort first as free but not be selected as free. A sharedisFreeRatehelper would keep them aligned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hosted checkout did not pre-select free shipping when a free rate was available (AIROBUILD-7255).
Cause.
ShippingMethodFormauto-applies a rate withmatchedMethod || firstMethod.matchedMethodis the form value or the draft order'sshippingLines.requestedService. So any paid rate that was already applied — auto-applied earlier, or already on the draft order when checkout loads — stays selected over a $0 rate. The cheapest rate is only chosen when nothing is selected yet. A fresh checkout with no shipping line already worked.This shows up when:
Fix. The auto-apply now chooses, in order:
When the free auto-apply fails, the form shows the rate the draft order still has, instead of leaving the free radio checked. The processed state is not reset, so the failed rate is not retried in a loop.
Known limits
Changeset
@godaddy/reactpatchTest Plan
New file
checkout-free-shipping-default.test.tsx:* Fails when only that part of the fix is removed.
Changed
checkout-free-order.test.tsx: "switches to FreePaymentForm when selecting a free shipping rate…" reached "Pay now" only because the paid line stuck while a free rate was offered. It now clicks the paid rate first, then free, and still checks the switch to the free-order form.npx vitest run src/components/checkoutinpackages/react: 741 passedtsc --noEmitand Biome: clean🤖 Generated with Claude Code