The Functions Console gets a fifth category:
Cart Transform
. Write JavaScript that reshapes the cart itself — bundle products together, break bundles apart, or change how lines are presented, with any logic you can express in code.- 🧩 Merge— combine several cart lines into a single bundle line, with an optional bundle discount.
- 📦 Expand— split one line (a bundle SKU) into the component items it contains.
- 🎨 Update— override a line's title, image or price (Shopify Plus and development stores).
How it works
Open the
Cart Transform
folder in the Functions Console and click Add new
. Pick the General
family, or Tags
to build rules around product and customer tags — think "merge everything tagged bundle
into one discounted line". Write a function body that returns transform operations; the starter code documents the exact shapes, and the editor's autocomplete knows your input inside out.Turn the function on and it runs on
every cart change
— buyers see merged bundles and expanded components in the cart immediately, no checkout required.A few things worth knowing
- Each store can have onecart transform function — it's the single place your cart-reshaping logic lives.
- The function's title is internal — buyers never see it.
- Bundle parent variants and component IDs are best kept in variables, so merchants can point the rule at different products from the dashboard without touching code.
- Like all functions, cart transforms are free— they don't consume credits.
- Cart transforms fail open: if your code errors, the cart is left unchanged — buyers are never blocked.
- The AI assistantcan build cart transforms for you — describe the bundle logic in Build with AI and review what it writes.
Full guide and ready-made examples in the docs:
Functions → Cart Transform
.