See all services → Shopify Plus Partner
API Developer

Fix Hydrogen Analytics Currency and Cart Request Changes

Hydrogen's October 8 preview adds predictive search and in-cart variant swapping, but also changes product view events to carry full prices and rejects cart requests that batch different change types.

Executive summary

What changed

Cart line updates now accept a merchandise ID, so a shopper can move a line to a different variant without removing it and adding it back. The React Router template gains a predictive search drawer that suggests products as the shopper types.

Two changes will break existing code. Product view events now take the variant's full price object rather than the amount string, so Shopify analytics reads the currency from the event itself. If you were passing the amount, pass the price. Separately, the cart route now rejects JSON requests that mix line, discount code, attribute, and note changes in one call. Each kind of change needs its own request, and the cart store rolls back the optimistic update for a rejected call. Hydrogen's own cart forms already behaved this way, so this mainly affects hand-rolled JSON calls.

Stale-while-revalidate refreshes of Storefront API responses now continue after the triggering request ends, bounded by the client timeout. The standalone cart actions export for Vue is removed in favour of the one from the cart components factory, which preserves your cart fragment types. Fixes cover discount codes updating as soon as a cart change settles, money ranges no longer rounding the upper bound, a trailing space in some locales, and redirect lookup errors being logged rather than swallowed.

Why it matters

The currency change is worth acting on first. An amount string without a currency meant Shopify analytics had to infer currency from context, which is fine for a single-market store and wrong for everyone else. Multi-currency merchants have been reconciling product view revenue against a currency the event never carried. The full price object fixes that at the source rather than in reporting.

The single-change-per-request rule reads like a restriction but is better understood as a correctness fix. Batched cart mutations that mixed concerns produced ambiguous optimistic state, and rollback on partial failure was unreliable. Splitting them means more requests and less guessing. Teams that built custom cart clients instead of using the shipped forms carry the work, one of the recurring trade-offs in enterprise headless commerce on Hydrogen.

Variant swapping on a cart line is a modest API change with a real conversion effect: changing a size in the cart no longer means a remove-then-add sequence that loses line attributes and flickers the cart total.

Role-specific impact

Use-case example

Real-world scenario

An apparel brand selling in five currencies found product view revenue consistently matched the store's primary currency, overstating non-primary markets by the exchange difference. After passing the full price object, roughly 35 percent of product view events report their real currency. The same release lets shoppers change size in the cart, removing a remove-and-re-add step responsible for a visible share of mobile cart abandonment.

Implementation checklist

  1. Search for product view events passing a price amount and replace them with the full price object.
  2. Audit any custom cart JSON client for requests that mix line, discount, attribute, and note changes.
  3. Split those into separate requests and confirm optimistic rollback behaves as expected.
  4. Move Vue projects off the removed standalone cart actions export.
  5. Pass the shop currency into the Shopify scripts component if your app began on an earlier preview template.
  6. Re-validate money formatting where ranges or non-English locales are displayed.

FAQ

Q: Will the cart request change break our checkout?

A: Only if you built a custom JSON cart client that batches change types. The shipped cart forms already send one kind of change per request.

Q: Do we need to backfill historical analytics after the currency fix?

A: No, but note the change date. Product view revenue before and after will not be directly comparable in non-primary currencies.

Resources

Hydrogen developer preview documentation

Need guidance? Talk to Makro.