-
Notifications
You must be signed in to change notification settings - Fork 380
feat(cart): add cartDeliveryAddressesReplace mutation support #3406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
9191fde to
ad18687
Compare
| @@ -0,0 +1,30 @@ | |||
| import {describe, it, expect} from 'vitest'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: these tests are bad. there's existing precedent, we're going to fix these after 2025-10 release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ones we don’t fix should be removed, because this is leading LLMs to generate more dud tests like these when prompted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed! (for the future, once we overhaul the tests). I would love for this codebase to be a perfect example of fabulous tests!
ad18687 to
d6a09a1
Compare
| DeliveryAddressesAdd: 'DeliveryAddressesAdd', | ||
| DeliveryAddressesUpdate: 'DeliveryAddressesUpdate', | ||
| DeliveryAddressesRemove: 'DeliveryAddressesRemove', | ||
| DeliveryAddressesReplace: 'DeliveryAddressesReplace', | ||
| DiscountCodesUpdate: 'DiscountCodesUpdate', | ||
| GiftCardCodesUpdate: 'GiftCardCodesUpdate', | ||
| GiftCardCodesRemove: 'GiftCardCodesRemove', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Re: lines +80 to +100]
this is a very weird test, it doesn’t verify anything, only makes it so we have to copy paste this twice
i’d recommend doing the satisfies thing i did in the other PR
correct me if im wrong but this test is asserting "all the cart actions are present in the CartForm.ACTIONS object"
See this comment inline on Graphite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I agree. Since we have plans to overhaul all these tests after the release we can get to it then
d6a09a1 to
825d717
Compare
04f9469 to
bce6ffc
Compare
825d717 to
6ecddea
Compare
Enable batch replacement of all cart delivery addresses via new
Storefront API 2025-10 mutation.
Why: The existing Add/Remove/Update mutations require multiple calls
to fully replace addresses. The new Replace mutation simplifies
workflows where the entire address list should be swapped atomically.
How:
- Add cartDeliveryAddressesReplaceDefault.tsx following sibling patterns
- Integrate replaceDeliveryAddresses method in createCartHandler
- Add DeliveryAddressesReplace action to CartForm.ACTIONS
- Include changeset for minor version bump
Usage:
const result = await cart.replaceDeliveryAddresses([
{ address: { deliveryAddress: {...} }, selected: true }
]);
6ecddea to
13a6f89
Compare

WHY are these changes introduced?
The existing
cartDeliveryAddressAdd,cartDeliveryAddressRemove, andcartDeliveryAddressUpdatemutations require multiple API calls to fully replace a cart's delivery addresses. The new Storefront API 2025-10cartDeliveryAddressesReplacemutation enables atomic replacement of all addresses in a single call.This simplifies workflows where merchants need to swap the entire address list—such as switching between saved address profiles or handling B2B scenarios with multiple ship-to locations.
WHAT is this pull request doing?
Adds support for the
cartDeliveryAddressesReplacemutation through:replaceDeliveryAddressesmethod increateCartHandlerDeliveryAddressesReplaceaction inCartForm.ACTIONScartDeliveryAddressesReplaceDefault.tsxUsage:
HOW to test your changes?
N/A
Checklist