Repository navigation
feat(preview): update cart to add cart attribute support - #3897
Merged
Merged
Conversation
frandiox
reviewed
Aug 13, 2026
frandiox
approved these changes
Aug 13, 2026
Contributor
There was a problem hiding this comment.
Couple of minor things but I think this makes sense. Thank you!
(look at this comment above as well just in case #3897 (comment) )
| projectAttributeErrors(current, result, payload.attributes, timestampMs), | ||
| ); | ||
| } | ||
| if (!result.cart || (result.userErrors?.length ?? 0) > 0) return state; |
Contributor
There was a problem hiding this comment.
We don't use result.cart.attributes because the standard action is not supposed to return it, right? But Hydrogen's /api/cart does?
Collaborator
Author
There was a problem hiding this comment.
Yep thats right. For the cart attributes we decided to follow the notes approach where we don't include it in the cart promise return payload
Collaborator
Author
I would say both! It falls into two categories:
|
andguy95
force-pushed
the
an-support-cart-attributes
branch
from
August 14, 2026 01:57
f4064c8 to
30db117
Compare
IgorOffline
pushed a commit
to IgorOffline/Shopify-hydrogen
that referenced
this pull request
Oct 10, 2026
Adds support for attributes support in our cart handlers
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.
TL;DR: Adds end-to-end cart attribute support to Hydrogen’s cart primitive, including mutations, optimistic state, scoped errors, examples, and packaged skill guidance.
Before
Hydrogen cart forms supported lines, discount codes, and notes, but did not provide a complete contract for updating cart attributes.
After
Cart forms can submit the complete attribute list:
What this changes
cartAttributesUpdatequeries and server-handler support.Developer impact
Adds the public
AttributeandCartAttributeInputtypes, along withCartData.attributes,pending.attributes,errors.attributes, and theattributes-updateform contract.Attribute updates replace the complete attribute list. Consumers editing one attribute must resubmit unrelated attributes or they will be removed.
No changeset is included because this targets the preview release flow, which assigns the preview package version outside individual PRs. This would otherwise be an additive minor change.
UX impact
The Hydrogen and React Router examples now display a gift-message editor with an attribute-specific saving state.
Risk
How to Test
After the Standard Actions release is available:
pnpm install && pnpm build:pkgs.pnpm dev:rr.http://localhost:5173, add a product, and open the cart./cart.