post
https://api.loopsubscriptions.com/storefront/2026-04/bundle//transaction
Creates a transaction for a bundle. This is a critical, required step in the purchase flow - it tells Loop which products, box size, selling plan, and discount make up the bundle, and returns a txnId you attach to the cart.
Auth: Storefront-callable (no token).
If you skip this step, the purchased line items are not bundled - they land on the subscription as separate, unlinked items.
Which IDs go where
| You need | Value | From |
|---|---|---|
Path {id} | The Bundle ID | id in List / Read bundle details |
boxSizeId | A box size id | boxSizes[].id |
sellingPlanShopifyId | A selling plan Shopify ID (or null for one-time) | sellingPlans[].shopifyId |
discountId | A discount id (optional) | discounts[].id |
productVariants[].shopifyId | Variant Shopify IDs | products[].variants[].shopifyId |
Note:
- Create a transaction each time a customer adds a new bundle to the cart.
- If the customer edits the same bundle before purchase, don't create another one - call Update bundle transaction with the same
txnId(This API is only applicable before purchase is completed).
⚠️ Getting quantity right (most common mistake)
quantity right (most common mistake)productVariants[].quantityis the quantity of that child variant in the bundle. The total number of items in the box is the sum of these.- Top-level
quantityis the number of bundles and defaults to1. For a BYOB bundle this should stay1. Do not put the total item count here - passing e.g.12because there are 12 items will corrupt the subscription.
✅ Correct - 12 items expressed as child quantities; bundle quantity stays 1:
{
"boxSizeId": "01HHD6D5XDTFFA83RSZ8XNEKT9",
"sellingPlanShopifyId": 1051852993,
"quantity": 1,
"productVariants": [
{ "shopifyId": 47875709174063, "quantity": 8 },
{ "shopifyId": 47875709174064, "quantity": 4 }
]
}After you get txnId: attach it to the cart
txnId: attach it to the cartAdd the txnId as the line-item property _bundleId: txnId on the Shopify /cart/add.js call, for every bundle line. The key must be exactly _bundleId.