Bundle functions (cart transforms)
How NERD Functions bundles work: merge rules for mix and match, expand rules for fixed bundles, bundle pricing, attributes, and the one-active-bundle rule.
What it is
A bundle function is a Shopify cart transform. It runs when the cart is assembled and can change which lines exist, before discounts are calculated. NERD Functions supports the two operations Shopify offers:
- Merge: several lines become one bundle line with a parent product. Used for mix and match, build your box, and “shown as one item” bundles.
- Expand: one line becomes several component lines. Used for fixed bundles where inventory and fulfillment must see the real items.
Merge rules
A merge rule names the lines to merge (a line match on a property, product, or tag), the parent variant to show (literal or read from a line property), the component quantity per bundle, an optional price, and attributes to stamp on the merged line. The mix and match template is a complete merge rule driven by three line item properties.
Expand rules
An expand rule names the lines to expand (typically products that have a components metafield), where to read the components from (a product metafield, a line property, or a fixed list), the price, and attributes for each component. The fixed bundle template reads components from custom.bundle_components.
Pricing
A merge or expand can leave prices alone or set:
- Percentage decrease on the components’ total.
- Fixed price for the bundle.
- Fixed price per unit for each component.
Price rules can be conditional, for example a larger decrease at six components than at three.
Rules per function and active bundles
The Basic plan allows one bundle rule per bundle function; Advanced allows ten. A store can have many bundle functions saved but only one active at a time, because Shopify allows one cart transform per app. Activating another switches: the previous one becomes inactive and the Shopify resource is re-pointed at the new rules.
Limits
- Not compatible with selling plans (subscriptions).
- Parent products for merges must be real products with a variant.
- Component variants for expands must be available for sale.
Updated