Problem
Each bundle had to look like one line in the cart and the order, yet keep the real variants and SKUs for the warehouse. The brief also said the store must keep selling if any outside service went down, and a failure must never lower a price by mistake.
Solution
A widget on the product page adds one line per chosen item. A Cart Transform Function on Shopify's own infrastructure groups them into packs, picks the discount tier from the real quantity and merges them into a single bundle line. Configuration lives in metaobjects and metafields. A separate admin lets the merchant edit bundles with a live preview.
Key decisions
Chose an app made only of a Shopify Function, with the widget as theme files
Why The storefront keeps selling even if everything I host goes offline.
Chose to compute the discount on the server from the real cart quantity
Why Nothing sent by the browser can change the rate, so a tampered request cannot get a bigger discount.
Chose a fail-safe default for the bundle variants
Why If the Function is missing, the bundle is blocked instead of being sold at the wrong price.
Chose tests that check money, not operations
Why Prices stay identical across the product page, cart, checkout and order, and for any add-to-cart order.
Results
- Prices matched from product page to cart, checkout and order in end-to-end tests.
- The Function is active on the production Plus store.
- Every bundle shows as one line, with the real variants kept inside it.
- Pricing tests also pass for every add-to-cart order up to twelve items.
- A merchant admin with a live widget preview, analytics and CSV import.


