Build vs. Buy>Platform & Architecture>Function Resource Ceilings

Shopify Function Limits: When Rule Logic Outgrows One Function

Written by Deploi EditorialReviewed by Martin Dejnicki, Director of SEO & AI SearchUpdated September 2026Pricing verified September 2026

Shopify Function resource ceilings make this a DEPENDS. A single function gets 256 kB of compiled binary, 10,000 kB of runtime linear memory, 512 kB of stack and 11 million instructions for carts of 200 line items or fewer. Bounded rule sets fit and should be built. Combinatorial rule sets across segments and catalogs outgrow one function, and a promo-engine app from $49/month (verified Sep 2026) has already paid that architecture cost.

Your profile — see how the verdict shifts

VerdictDEPENDS on the shape of the rule set · BUILD one function while the logic stays bounded inside 256 kB and 11 million instructions · BUY a promo engine from $49/month (verified Sep 2026) once the rules go combinatorial
Buy score
6.4
Build score
6.8
Confidence
HighEvery number on this page comes from Shopify's own Functions reference, re-read on 2026-09-05, and the page groups them deliberately. Under Fixed limits: compiled binary size 256 kB, runtime linear memory 10,000 kB, runtime stack memory 512 kB. Under Dynamic limits: execution instruction count 11 million instructions, for carts of up to 200 line items, with Shopify stating that certain limits scale based on the number of line items and will scale proportionally above 200. Function input is capped at 128 kB and function output at 20 kB. The page defines 1 kB as 1000 bytes, so the binary budget is 256,000 bytes rather than 262,144. Input queries carry their own ceilings: 3000 bytes excluding comments, a maximum calculated query cost of 30, and no more than 100 elements in list-type field arguments or input query variables. Two more platform rules shape the fork. Only stores on a Shopify Plus plan can use custom apps that contain Shopify Function APIs, while stores on any plan can use public App Store apps that contain functions. And you can activate a maximum of 25 discount functions on each store, which is what makes splitting a rule set a real strategy rather than a workaround. On the app side, Discount Ninja Promo Engine (4.4★, 170 reviews) prices by discounted orders influenced rather than by feature, and Bold Discounts (4.0★, 477 reviews) covers scheduled sales rather than general rule logic. Neither listing states how it distributes rule evaluation, so the architecture claim is an inference from their pricing shape.
Reference scenario
$20M–$100M GMV · Shopify Plus · a discount or shipping function already in production, growing a branch at a time · agency or in-house dev bench
As of
September 2026

Decision at a Glance

Your profileVerdictWhy
One rule, few branches (flat percentage, single segment)BUILDA rule this size uses a fraction of 256 kB and nowhere near 11 million instructions. An app subscription for it is rent on something you'd finish in a fortnight.
Bounded rule set · 5–20 branches on one axisBUILDStill comfortably inside the ceilings, and configuration in metafields keeps the binary flat as rules multiply. Watch the instruction count rather than the binary size.
Combinatorial · segments × catalogs × product groupsBUYRule count multiplies rather than adds, and 11 million instructions arrives faster than anyone plans for. A promo engine at $49–$399/month (verified Sep 2026) has already solved the distribution problem.
B2B or wholesale carts routinely above 200 line itemsCUSTOMIZEShopify scales the dynamic limits proportionally above 200 line items, so the instruction budget moves with the cart. The 128 kB input cap and the query-cost ceiling of 30 become the binding constraints instead.

What Function Resource Ceilings Actually Drives

OutcomeImpactHow it works
Revenue — directHighA discount or shipping function that exceeds its instruction budget stops applying the offer, so carts price wrongly at exactly the moment a campaign is driving volume.
Operational efficiencyHighRules held in metafield configuration let merchandising change a threshold without a deploy, which removes engineering from the campaign calendar entirely.
Customer experienceMediumA failing function shows a buyer the wrong price at checkout with no error message, which is the version of breakage shoppers report as a scam rather than a bug.
Data & insightMediumOwning the rule definitions means promotion logic is queryable alongside order data, rather than living inside a vendor's promotion model you can only read through its UI.

Spend ceiling: Spend on the configuration model before spending on more code. A rule set expressed as metafield data stays inside 256 kB indefinitely; the same rules compiled as branches will eventually cost you a rewrite at the worst time.

What buying enables (top apps)

  • + Combinatorial promotions across segments, catalogs and product groups with no instruction budget to manage
  • + A merchant-facing campaign UI that marketing runs without a deploy
  • + Vendor-absorbed API version bumps, which on this platform arrive several times a year
  • + Scheduled sales, countdown timers and auto-tagging bundled with the rule engine rather than built separately

What building additionally unlocks

  • + Rules no vendor schema expresses, priced exactly as the business decides
  • + The full 256 kB and 11 million instructions per function, spread across up to 25 activated discount functions
  • + Configuration in metafields, which Shopify names as more efficient than an external network call during checkout
  • + A Rust hot path when instruction headroom matters more than development speed

Find Your Verdict in 3 Questions

  1. Does the rule set grow by adding branches, or by multiplying segments against catalogs?

    Yes: Go to question 2.

    No: Your verdict: BUILD — a bounded rule set sits well inside 256 kB and 11 million instructions, and one function is the right shape for it.

  2. Can the variation live in metafield configuration instead of compiled branches?

    Yes: Your verdict: BUILD — configuration keeps the binary flat, and function settings let merchants change behavior without a redeploy.

    No: Go to question 3.

  3. Does any vendor's promotion model actually express the rules the business wants?

    Yes: Your verdict: BUY — a promo engine from $49/month (verified Sep 2026) has already paid the architecture cost of spreading rule evaluation.

    No: Your verdict: BUILD — split the rule set across several of the 25 activated discount functions Shopify allows per store.

The TCC Scorecard — 12 Dimensions

TCC — Total Cost of Capability: what it actually costs to have this capability over three years, whichever way you get it. Each dimension is scored 0–5 for both paths. How we score →

DimensionBuyBuildWhy
Cost
Acquisition & implementationA promo engine installs in a day; a multi-function rule engine with shared configuration runs 8–14 weeks (Deploi estimate, illustrative).
Recurring feesDiscount Ninja steps from $49/month to $399/month by discounted orders influenced (verified Sep 2026), so the bill grows with success; a function you own has no subscription.
Maintenance & upgradesThe vendor absorbs Shopify's API version bumps; you absorb them yourself, plus the work of keeping each function under its ceilings as rules accumulate.
Switching & exitPromotion configuration lives in the vendor's model and rarely exports cleanly; your own functions and metafields stay in your repository.
Risk
Vendor riskDiscount Ninja carries 170 reviews and Bold 477, so the category is established rather than fragile, but a discount engine is a hard dependency at checkout.
Security & compliance surfaceAn app evaluates your pricing logic on its own infrastructure; a function runs inside Shopify with metafield configuration and no external call.
Platform-deprecation exposureShopify Functions are current platform, but the ceilings themselves can move, and a build sitting at 90% of 11 million instructions has no margin for a version change.
Value
Fit to requirementAn app models the promotions its schema anticipated; a function models exactly the rule you wrote, including the one no vendor supports.
Time to marketAn app runs a campaign this week, while the multi-function split lands next quarter.
Performance & scaleBoth run as functions inside checkout, but a rule set spread across up to 25 activated discount functions distributes the instruction budget the way one binary cannot.
Data ownership & AI-readinessPromotion logic and its configuration are commercial strategy; kept in metafields and your repository, they are queryable and portable rather than rented.
Focus & opportunity costBuilding a general rule engine is a product project in disguise, and it competes with everything else the team could ship this quarter.

The App Landscape

AppStatusPricingBest for
Discount Ninja Promo EngineLive4.4★, 170 reviews; 14-day free trial on all paid plans. A public App Store app, so it runs on any plan rather than Plus only. Order allowances count only the orders the app influenced. Confirm on the current listing which surfaces each promotion type reaches before you rely on it at a till.Starter $49/month (500 discounted orders), Pro $99/month (1,000), Grow $199/month, Plus $399/month (10,000 discounted orders) — verified Sep 2026Combinatorial promotion rules you would otherwise split across many functions
Bold Discounts — Flash SalesLive4.0★, 477 reviews. Scheduled sales, countdown timers, auto-tagging and unlimited sale groups, with the promotion calendar held in the app's own configuration. The free plan is labeled for development shops only rather than live stores, so Essentials is the real entry price. The listing has been renamed at least once, which is worth noting in any internal documentation that points at it.Free (labeled for development shops only, not live stores); Essentials $19.99/month with a 14-day free trial (verified Sep 2026)Scheduled flash sales and sitewide markdowns without writing a function
Function settings (metafield configuration)NativeFirst-party Shopify component. The function settings component configures metafield settings for Shopify Functions and integrates with the native save bar, so merchants adjust behavior without a redeploy. Moving variation out of the binary and into configuration is the cheapest way to stay well under 256 kB as rules accumulate.Included with Shopify FunctionsKeeping rule variation in configuration rather than compiled into code
Split rule set across several functionsBuild laneShopify allows a maximum of 25 activated discount functions per store, so a rule set that no longer fits in one becomes three or four narrow ones sharing metafield configuration. Custom apps containing Shopify Function APIs are Plus-only; public App Store apps containing functions work on any plan.$18,000–$60,000 one-time for a multi-function rule engine (Deploi estimate, illustrative)Plus merchants whose rules are specific enough that no vendor models them

The Build Path

  • Configuration in metafields, logic in code: Every rule you express as data rather than as a branch keeps the compiled binary flat against its 256 kB ceiling. Fetching from metafields during checkout also avoids an external network call, which Shopify names as the more efficient path.
  • Split across several narrow functions: Up to 25 discount functions can be active on one store. Splitting by rule family (cart-level, product-level, shipping) gives each its own 256 kB and 11 million instructions instead of sharing one budget.
  • Rewrite the hot path in Rust: Shopify warns that JavaScript functions run into instruction limits sooner than logic compiled directly to WebAssembly, and names Rust. A rewrite buys instruction headroom without changing what the rule does.
Effort band
$18,000–$60,000 one-time (Deploi estimate, illustrative); lands in the $25–75K contact-form band once the rule set needs more than one function and a shared configuration model
Typical timeline
8–14 weeks (Deploi estimate, illustrative): rule inventory first, then the configuration model, then the split across functions
Maintenance, honestly
$6,000–$15,000/yr (Deploi estimate, illustrative): API version bumps, instruction-budget checks after each rule addition, and regression tests on carts near 200 line items.
What you own — and what you take on
You own: the rule logic, the configuration model, and the freedom to price however the business decides rather than however a vendor's schema allows. You take on: staying under 256 kB and 11 million instructions forever, and noticing when a new rule quietly halves the margin.

3-Year Total Cost of Capability

Buy (app path)Build (custom path)
Year 0 (setup)$0–$1,200 (illustrative)$18,000–$60,000 (Deploi estimate, illustrative)
Years 1–3 (recurring)$1,764–$14,364 (illustrative)$18,000–$45,000 (Deploi estimate, illustrative)
3-year total≈$1,764–$15,600 (illustrative)≈$36,000–$105,000 (Deploi estimate, illustrative)
Illustrative cumulative cost over 36 months$0$17k$35k$52k$70kMo 0Mo 12Mo 24Mo 36Buy (app path)Build (custom path)
Illustrative cumulative cost: at mid-tier app pricing the build never pays back inside three years on money alone. It pays back when the rule the business wants has no field in any vendor's schema, or when discounted-order tiers step twice in one growth year.
  • All figures illustrative samples for the reference scenario — not quotes, not verified pricing.
  • App path: a promo engine on a mid tier, held flat, though its pricing steps with discounted orders influenced and real bills rise with success.
  • Build path: a rule inventory, a metafield configuration model, and a split across three functions; three-year horizon.

What the Sticker Price Hides

On the buy path

  • Discount Ninja's tiers step by discounted orders influenced, so a successful campaign is what moves you from $49/month to $399/month (verified Sep 2026)
  • Bold's free plan is labeled for development shops only, which is easy to misread as a free production tier
  • Promotion configuration rarely exports in a form another engine can read, so the second migration costs more than the first
  • Neither listing states how it distributes rule evaluation, so the ceiling problem may simply move rather than disappear

On the build path

  • Instruction budget is invisible until it isn't — nobody notices 8 million until a large cart fails
  • JavaScript hits the instruction ceiling sooner than Rust, and the rewrite arrives at the worst possible moment
  • A 3000-byte input query and a calculated query cost of 30 limit what the logic can even see
  • $6,000–$15,000/yr of upkeep and budget monitoring (Deploi estimate, illustrative)

What Merchants Say

The pattern engineering teams describe: the function shipped fine, then six rule additions later a large cart started failing and nobody had been watching the instruction budget.
community-reported (2026 research corpus)
Promo-engine buyers flag the pricing shape rather than the product — tiers step by discounted orders, so a good campaign is what pushes the bill to the next band.
app-store 1–2★ review theme

If You Change Your Mind Later

If you bought and outgrow it

Leaving a promo engine means rebuilding every active promotion in whatever replaces it, because promotion models differ enough that exports rarely transfer cleanly. Capture the rule definitions as your own documentation while the app is live, not during the migration.

If you built and want out

Your functions and their metafield configuration stay in your repository and on your store, so switching to an app later is a configuration exercise rather than a data loss. The functions can even run alongside an app during the transition, since Shopify allows up to 25 activated discount functions per store.

When This Answer Changes

We're watching for:

  • Shopify raising or restructuring the fixed limits (256 kB binary, 10,000 kB linear memory, 512 kB stack) in a future API version
  • Your function crossing roughly 70% of 11 million instructions on a representative large cart, which is the point to plan the split
  • A rule request that needs data the 3000-byte input query or the query-cost ceiling of 30 cannot carry

Verdict change log:

No changes since first publication (September 2026).

Common Questions

What are the resource limits on a single Shopify Function?

Shopify sets four ceilings on one function: 256 kB compiled binary size, 10,000 kB runtime linear memory, 512 kB runtime stack memory, and 11 million execution instructions. The page defines 1 kB as 1000 bytes. Binary size and memory sit under Fixed limits; the instruction count sits under Dynamic limits and applies to carts of up to 200 line items, scaling proportionally above that.

How do you split rule logic across more than one function?

Shopify lets you activate a maximum of 25 discount functions on each store, so splitting a large rule set across several narrow functions is the documented path. Each function carries its own 256 kB binary and 11 million instructions. Function input caps at 128 kB and output at 20 kB, so the split has to divide the data too, not just the code.

Does the language you write the function in matter?

Shopify warns that JavaScript functions hit instruction limits sooner than logic compiled directly to WebAssembly, naming Rust as the alternative. With 11 million instructions on the clock for carts up to 200 line items, that gap decides whether a growing rule set still fits. Rewriting the hot path in Rust buys headroom without changing behavior, and costs an estimated 2–5 weeks (Deploi estimate, illustrative).

Your Next Steps

If you're going with BUILD

  1. Measure the current function against 256 kB compiled and 11 million instructions on a representative large cart
  2. Move every rule that can be data out of the branches and into metafield configuration
  3. Split by rule family once one function passes roughly 70% of its instruction budget
  4. Add function settings so merchants change behavior without a redeploy
  5. Regression-test carts at and above 200 line items, where the dynamic limits start scaling

If you're going with BUY

  1. Write down the five rules the business actually wants, then check each against the vendor's model
  2. Price the app at next year's discounted-order volume, not this year's
  3. Confirm with the vendor how rule evaluation is distributed, since no listing states it
  4. Keep your own written definitions of every promotion so a future migration has a source
  5. Diary a re-decision when the tier steps or a rule request gets refused

Official Docs & Sources

Official documentation linked for verification — our verdicts and estimates are our own.

Is your function running out of room?

We measure where a rule set actually sits against 256 kB and 11 million instructions, then either buy you headroom through configuration and a split, or tell you plainly that a promo engine is the cheaper answer.

Contact us today

Ecommerce development at Deploi

Verdict scored for the reference scenario above. Estimates are not quotes; app pricing carries its verification date and gets re-verified quarterly. Full scoring anchors: see the TCC methodology.

Read how we score these decisions (the TCC Framework). No affiliate links, no paid placement — no app vendor pays to appear here.

No affiliate links. No paid placement. We make money building and integrating solutions — not on referral fees.