Add a changelog.json entry for the next release (includes cookie updates) #3334
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.
The main code block (step 2 of the cookie migration feat) contains the following as markdown:
React Router + Hydrogen on Oxygen
If you scaffolded from the default Hydrogen skeleton and deploy to Oxygen, the
createRequestHandlerutility from@shopify/hydrogen/oxygen(now also exported from@shopify/hydrogen) already sets up a Storefront API proxy on the same domain as your storefront.In most cases, no changes are required; just confirm your server entry still uses it:
Keep using
<Analytics.Provider>component oruseCustomerPrivacyhook to get cookies in the browser automatically.For a full example, refer to our skeleton template.
React Router + Hydrogen on other hosts
Hosts that support Web Fetch API (Request/Response)
On hosts that support the standard Web Fetch API (Workers-style environments), import
createRequestHandlerfrom@shopify/hydrogen(instead ofreact-router) and route requests through it:Node.js and other hosts
For Node-like environments, adapt Node requests to Fetch with
@remix-run/node-fetch-server, then delegate to Hydrogen's handler:Alternatively, if you can't delegate to Hydrogen's
createRequestHandler, you can provide a custom Storefront API proxy in your server. See Hydrogen's implementation as a reference. In this case, ensure you manually passsameDomainForStorefrontApi: truein theconsentobject for<Analytics.Provider>or as a prop to theuseCustomerPrivacyhook.