Bundle function (cart transform) · Plan: Basic
How do I let shoppers build their own bundle and show it as one line with one price at checkout?
Use a bundle (cart transform) function with a merge rule. The theme passes a few line item properties when adding each component, and the Function merges lines that share a bundle id into one bundle line, priced at a percentage off, a fixed price, or a fixed price per unit.
- Function typeCart transform (bundle)
- Plan neededBasic
- Shopify PlusNot required
- TemplateShips in the app as "Mix and match bundle"
- Updated
What the shopper sees
On a “build your box” page they pick, say, six snacks. In the cart and at checkout those six lines appear as one “Snack box” line at the bundle price, with the components listed underneath. Orders, fulfillment, and inventory still see the component variants.
How the rule is built
The Mix and match bundle template creates a merge rule:
- Line match: lines where the property
_bundleUniqueIdexists. - Parent variant: read from the
_bundleParentIdproperty (the bundle product variant shown as the parent line). - Component quantity: read from
_bundleItemSize. - Price: none by default. Set a percentage decrease, a fixed price, or a fixed price per unit for the bundle.
- Attributes: copies
_bundleUniqueIdonto the merged line as_bundleId, so two identical boxes stay distinct.
What the theme has to do
Mix and match is the one pattern that needs a storefront change, because the Function only learns the shopper’s picks when they are added. On add to cart, every component gets three line item properties: the same _bundleUniqueId for all lines of one build, _bundleItemSize for units per bundle, and _bundleParentId for the parent variant. The template tutorial in the app shows a complete cart/add.js example.
Variations
- Tiered bundle price. Add price rules on the merge, for example 10% off at three components and 20% off at six.
- Fixed box price. Fixed price value: six snacks for 24 regardless of which six.
- Multiple bundle types. The Basic plan allows one bundle rule per function; Advanced allows up to ten, so a store can run a snack box and a gift box from one function.
Limits to know
- One bundle function can be active per store at a time (Shopify allows one cart transform per app). Put all bundle rules in that function.
- Bundle functions are not compatible with selling plans (subscriptions).
- The parent bundle product must exist as a real product with a variant so Shopify can show it as the parent line.