-
Notifications
You must be signed in to change notification settings - Fork 380
feat(cart): add visitorConsent support to @inContext directive #3408
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
feat(cart): add visitorConsent support to @inContext directive #3408
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. |
32cb4da to
aaedbc8
Compare
04f9469 to
bce6ffc
Compare
aaedbc8 to
ad445a5
Compare
ad445a5 to
8444e31
Compare
| variables: { | ||
| cartId: optionalParams?.cartId || options.getCartId(), | ||
| attributes, | ||
| ...optionalParams, |
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.
this was missing before. it's present in the other ones
Adds Storefront API 2025-10 parity for the `visitorConsent` parameter in `@inContext` directives across all cart operations. **Important:** Most Hydrogen storefronts do NOT need this feature. If you're using Hydrogen's analytics provider or Shopify's Customer Privacy API (including third-party consent services), consent is handled automatically. This feature is primarily intended for Checkout Kit and other non-Hydrogen integrations that manage consent outside Shopify's standard consent flow. Changes: - Add `visitorConsent` to `CartOptionalInput` type with clear JSDoc explaining the niche use case - Update all cart mutation/query defaults to accept and pass through `visitorConsent` to the `@inContext` directive - Update `hydrogen-react` cart queries with `visitorConsent` variable support
8444e31 to
a2645af
Compare

WHY are these changes introduced?
Closes https://github.com/Shopify/developer-tools-team/issues/967.
Adds Storefront API 2025-10 parity for the
visitorConsentparameter in@inContextdirectives.Note: Most Hydrogen storefronts do NOT need this feature. If you're using:
then consent is already handled automatically and you don't need to use this.
This feature is primarily intended for Checkout Kit and other non-Hydrogen integrations that manage consent outside Shopify's standard consent flow.
WHAT is this pull request doing?
Adds
visitorConsentsupport to all cart operations in both@shopify/hydrogenand@shopify/hydrogen-react:@shopify/hydrogenvisitorConsenttoCartOptionalInputtype; update all 17 cart mutations/queries with@inContext(visitorConsent: $visitorConsent)@shopify/hydrogen-reactvisitorConsentvariable supportWhen provided,
visitorConsentencodes buyer consent preferences (analytics, marketing, preferences, saleOfData) into the cart'scheckoutUrlvia the_csparameter.HOW to test your changes?
Cart operations now accept
visitorConsentas an optional parameter:Checklist