How pricing works
The rule defines adiscountType and discountValue, plus optional selection gates:
The discount applies only when the selection satisfies the configured gates:
- Item count between
minProductCountandmaxProductCount. - Selection value between
minOrderAmountandmaxOrderAmount.
Step 1 — Read the rule from the metafield
Read the active rules from theappstle_bundles.bundle_rules shop metafield — the Shopify-native source, with no call to Appstle’s servers (see Reading bundle configuration). Filter to dynamic pricing bundles by bundleType.
Step 2 — Render your selector
Build your own selector and gate the “add to cart” action on the rule:- Allow only eligible variants.
- Track the running item count and subtotal; enable checkout only when both gates are satisfied.
- Show the live discounted total using the preview formula.
Step 3 — Add the bundle to the cart
Add the selected variants with the bundle attributes. For a dynamic pricing bundle,_appstle_bundles_type is CLASSIC_BUILD_A_BOX.
Dynamic pricing bundles support subscriptions. If the selection uses a subscription purchase option, pass the chosen
selling_plan on the line (Ajax) or sellingPlanId on the merchandise line (Storefront API), exactly as you would for any subscription line item.Step 4 — Discount applies automatically
When the lines carrying the attributes satisfy the gates, Appstle’s automatic discount applies the percentage or fixed amount in cart and checkout. If the selection later drops below the gate (e.g. an item is removed), the Function stops applying the discount — your UI does not need to manage this.Previewing the discount
Mirror the Function’s math for a live preview (cart prices are in cents):This preview is display-only. The Shopify Function is authoritative at checkout; sourcing the preview from the same
discountType / discountValue / gate fields keeps them in sync.Checklist
1
Bundle is Active in the Appstle admin
2
Selection satisfies count and amount gates before checkout
3
Every line carries _appstle-bb-id and _appstle_bundles_type = CLASSIC_BUILD_A_BOX
4
Verify the discounted total in the cart matches your preview
Next steps
Volume discount bundle
Tiered “buy more, save more” discounts.
Fixed pricing bundle
Sell a curated set for one fixed price.