Skip to content

Conversation

@kdaviduik
Copy link
Contributor

@kdaviduik kdaviduik commented Jan 26, 2026

WHY are these changes introduced?

The existing cartDeliveryAddressAdd, cartDeliveryAddressRemove, and cartDeliveryAddressUpdate mutations require multiple API calls to fully replace a cart's delivery addresses. The new Storefront API 2025-10 cartDeliveryAddressesReplace mutation 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 cartDeliveryAddressesReplace mutation through:

  • New replaceDeliveryAddresses method in createCartHandler
  • New DeliveryAddressesReplace action in CartForm.ACTIONS
  • Default mutation implementation in cartDeliveryAddressesReplaceDefault.tsx

Usage:

const result = await cart.replaceDeliveryAddresses([
  { address: { deliveryAddress: {...} }, selected: true }
]);

HOW to test your changes?

N/A

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

Copy link
Contributor Author

kdaviduik commented Jan 26, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@shopify
Copy link
Contributor

shopify bot commented Jan 26, 2026

Oxygen deployed a preview of your 2025-10-deliveryAddressReplace branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment January 27, 2026 2:30 AM

Learn more about Hydrogen's GitHub integration.

@kdaviduik kdaviduik force-pushed the 2025-10-deliveryAddressReplace branch from 9191fde to ad18687 Compare January 26, 2026 04:46
@@ -0,0 +1,30 @@
import {describe, it, expect} from 'vitest';
Copy link
Contributor Author

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

Copy link
Contributor

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

Copy link
Contributor Author

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!

@kdaviduik kdaviduik force-pushed the 2025-10-deliveryAddressReplace branch from ad18687 to d6a09a1 Compare January 26, 2026 04:56
@kdaviduik kdaviduik marked this pull request as ready for review January 26, 2026 04:57
@kdaviduik kdaviduik requested a review from a team as a code owner January 26, 2026 04:57
@fredericoo fredericoo changed the base branch from 2025-10-sfapi-caapi-update to graphite-base/3406 January 26, 2026 10:34
Comment on lines 85 to 91
DeliveryAddressesAdd: 'DeliveryAddressesAdd',
DeliveryAddressesUpdate: 'DeliveryAddressesUpdate',
DeliveryAddressesRemove: 'DeliveryAddressesRemove',
DeliveryAddressesReplace: 'DeliveryAddressesReplace',
DiscountCodesUpdate: 'DiscountCodesUpdate',
GiftCardCodesUpdate: 'GiftCardCodesUpdate',
GiftCardCodesRemove: 'GiftCardCodesRemove',
Copy link
Contributor

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.

Copy link
Contributor Author

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

@kdaviduik kdaviduik force-pushed the 2025-10-deliveryAddressReplace branch from d6a09a1 to 825d717 Compare January 27, 2026 02:18
@kdaviduik kdaviduik changed the base branch from graphite-base/3406 to 2025-10-sfapi-caapi-update January 27, 2026 02:18
@kdaviduik kdaviduik force-pushed the 2025-10-sfapi-caapi-update branch from 04f9469 to bce6ffc Compare January 27, 2026 02:28
@kdaviduik kdaviduik force-pushed the 2025-10-deliveryAddressReplace branch from 825d717 to 6ecddea Compare January 27, 2026 02:28
@fredericoo fredericoo changed the base branch from 2025-10-sfapi-caapi-update to graphite-base/3406 January 27, 2026 11:10
@kdaviduik kdaviduik requested a review from fredericoo January 27, 2026 17:29
@kdaviduik kdaviduik changed the base branch from graphite-base/3406 to main January 27, 2026 17:31
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 }
  ]);
@kdaviduik kdaviduik force-pushed the 2025-10-deliveryAddressReplace branch from 6ecddea to 13a6f89 Compare January 27, 2026 17:32
@kdaviduik kdaviduik merged commit 0516581 into main Jan 27, 2026
11 of 13 checks passed
@kdaviduik kdaviduik deleted the 2025-10-deliveryAddressReplace branch January 27, 2026 17:32
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