Bundler: AJAX cart interception, 3 discount modes and Cart Transform limits
Public listing, vendor spec, and CDN JavaScript analysis of Bundler - Product Bundles: two-stage CDN loader, 30+ theme cart-drawer adapters, direct component /cart/add.js payloads, 3 checkout settlement paths, and why Cart Transform rejects selling_plan bundles.
- Idempotent bundler.js -> 963 KB widget engine
- Component SKU /cart/add.js (zero virtual stock)
- Draft Order vs Promo Code vs 25-limit Auto Discount
Investigation question
How does Bundler avoid synthetic virtual SKUs while deducting component inventory, route checkouts across Draft Orders, Discount Codes, and Automatic Discounts, and handle subscription selling_plan lines where Shopify Cart Transform Functions fail?
Observed
Inspecting Bundler’s Shopify App Store listing, vendor Markdown specifications (bundler.app/llms.txt, features, pricing, JS API, FAQs), Shopify Cart Transform documentation, and public storefront bundles (bundler.js + 963 KB bundler-script.js v79.01) exposes an AJAX-first bundling runtime predating Shopify Functions. At boot, Theme 2.0 App Embed loads bundler.js, checks BndlrScriptAppended to prevent duplicate injection, and mounts bundler-script.js with adapters for 30+ theme cart drawers, localStorage state, and schema.org/Product + Offer microdata. Crucially, Bundler never invents synthetic parent inventory SKUs: clicking add-to-cart submits individual component {id, quantity, selling_plan?} objects directly to POST /cart/add.js?bundler-call so Shopify core stock validation and inventory depletion operate directly on underlying component variants. At checkout, Bundler branches across three settlement mechanisms documented in its FAQs: Draft Order invoices via its /a/bundles/checkout/ (cdo.php) proxy, dynamically generated Shopify Discount Codes, or native Automatic Discounts (capped at Shopify’s 25 active automatic discount limit).
Inferred
Comparing Bundler’s client engine against modern Rust/Wasm Shopify Cart Transform Functions (lineExpand, linesMerge, lineUpdate) highlights a subtle platform boundary: Shopify’s Cart Transform API restricts lineUpdate to Plus/dev stores and explicitly rejects lineExpand, linesMerge, and lineUpdate whenever a cart line carries a subscription selling_plan. Passing component SKUs plus selling_plan directly through AJAX /cart/add.js explains why third-party subscription integrations work alongside Bundler, at the cost of accumulating Draft Orders or generated Discount Codes in Shopify Admin when Mode C’s 25-automatic-discount ceiling is reached. On the agent side, schema.org/Product tags and llms.txt are helpful, yet the absence of an OpenAPI spec or MCP endpoint prevents headless agents from querying Mix & Match slot constraints without running the storefront JS.
Unknown & limitations
This public-artifact analysis relies on published listings, vendor Markdown guides, Shopify Cart Transform specs, and static inspection of public CDN storefront bundles (where the unsplit 963 KB bundler-script.js also hit static semantic-analysis per-file caps on secondary symbol queries). Live app installation, checkout Draft Order invoice traces, and post-uninstall cleanup behavior were not executed.
Architecture
Bundler connects a Theme 2.0 idempotent bootstrap (bundler.js) to a standalone 963 KB storefront widget and checkout interceptor (bundler-script.js v79.01) plus an app proxy (/a/bundles/checkout/ and cdo.php) backed by hosted merchant bundle definitions.
Domain & data models
Supports Classic Fixed Bundles (product-level vs variant-level), Volume/Quantity Breaks, Mix & Match pools (min/max total and per-SKU caps), Sectioned Mix & Match slots, and Buy-X-Get-Y conditions across Free ($0), Premium ($9.99/mo), and Executive ($19.99/mo) tiers, storing widget/checkout flags in localStorage with zero virtual inventory records.
Workflows & state machines
Render mounts inside #bundler-target-element emitting bundler:bundle_widget_created -> add-to-cart injects component variants via /cart/add.js -> cart hooks intercept /cart/change.js and /cart/update.js to recompute eligibility -> checkout routes via Mode A (Draft Order invoice, dropping "Back to cart" and abandoned-checkout emails), Mode B (dynamic promo code), or Mode C (up to 25 Automatic Discounts).
API & protocol surfaces
Browser window.bndlr facade (getBundles, getCheckoutInfo, updateCartDiscounts, refresh, setCheckoutParams, preventBundlerCheckout, enableBundlerCheckout, checkout) plus DOM CustomEvents (bundler:bundle_widget_created, bundler:checkout_info_updated) and Seal Subscriptions selling_plan hooks; zero public merchant REST API or MCP server.