We are facing a problem with Shopify Functions input when selling-plan (subscription) lines and normal lines of the same variant are in the cart together.
Our setup
We run two completely separate flows and keep them separate using different line item properties:
| Flow | Line item property | Handled by |
|---|---|---|
| One-time bundles | _easyBundle:OfferId |
Cart Transform (cart.transform.run) — merges the lines |
| Subscription bundles | _bundleOfferId + selling plan |
Discount function (cart.lines.discounts.generate.run) |
Cart Transform never touches subscription lines (it doesn’t support selling-plan lines) — that’s exactly why we split the flows. So the two flows never share a line. But the prices still leak from one to the other.
Example
A wallet costs Rs. 200. It has a subscription plan “60% off” (plan price Rs. 80).
- Customer adds the wallet in a one-time bundle → cart line X, no selling plan. Our Cart Transform input shows line X = Rs. 200. Correct.
- Customer then adds the same wallet in a subscription bundle → new cart line Y, with the selling plan, Rs. 80. Fine.
- Our Cart Transform runs again. Line X is untouched — same line, same ID, still no selling plan. But its price in the input is now Rs. 80.
cart.transform.run input, line X (CartLine no selling plan):
run 1 (only one-time lines in cart): subtotalAmount = 200.0 ✓
run 2 (subscription lines also in cart): subtotalAmount = 80.0 ✗
Line X just inherited line Y’s selling-plan price because they’re the same variant. Our function’s math runs on these amounts, so every price it computes for the merged bundle fluctuates depending on whether a subscription line of the same variant happens to be in the cart. Our property-based filtering can’t protect us, because the leak is in cost.subtotalAmount itself, not in which lines we read.
Questions
- Is this expected? Should a no-plan cart line’s
costchange because a selling-plan line of the same variant exists in the cart? - If it is expected — how can a function read the line’s real (pre-selling-plan) price?
ProductVarianthas nopricefield andSellingPlanAllocationPriceAdjustmenthas nocompareAtPricein the Functions input schema (both exist in the Storefront API). Can these be exposed?
One cart line, before vs after
Same product, same one-time bundle line (_easyBundle:OfferId present, no selling plan). The only difference between the two runs: subscription lines of the same variant were added to the cart.
Run 1 — no subscription lines in cart → correct price (Rs. 200):
{
"id": "gid://shopify/CartLine/f33e9eed-38fa-4786-b142-9c1c0f7c415f",
"lineOfferId": { "key": "_easyBundle:OfferId", "value": "PB-133044_VX0_1" },
"quantity": 1,
"cost": {
"subtotalAmount": { "amount": "200.0", "currencyCode": "INR" }
},
"merchandise": {
"__typename": "ProductVariant",
"id": "gid://shopify/ProductVariant/46105732219131",
"title": "Black",
"product": { "title": "Leather Zip Wallet Updated" }
}
}
Run 2 — subscription lines of the same variant now in cart → price arrives already reduced (Rs. 80 = 60% selling-plan price):
{
"id": "gid://shopify/CartLine/2a960a74-d948-43c9-a590-cfa047f7ec7c",
"lineOfferId": { "key": "_easyBundle:OfferId", "value": "PB-133044_WZ9_1" },
"quantity": 1,
"cost": {
"subtotalAmount": { "amount": "80.0", "currencyCode": "INR" }
},
"merchandise": {
"__typename": "ProductVariant",
"id": "gid://shopify/ProductVariant/46105732219131",
"title": "Black",
"product": { "title": "Leather Zip Wallet Updated" }
}
}
Same variant (ProductVariant/46105732219131), same kind of one-time line, no selling plan on it — yet cost.subtotalAmount dropped from 200.0 → 80.0 purely because a subscription line of that variant exists in the cart. Our Cart Transform math runs on this amount, so the merged bundle price fluctuates.