Buying guide · 2026-12-01
How to choose Shopify Functions: the checks that matter before you commit
Choosing Shopify Functions work is choosing where custom logic should live. A Function is right when the rule must hold inside checkout itself: a discount no form can express, a payment method hidden for one class of order, a validation that blocks a bad cart. It is the wrong tool for anything needing live external data. Judge proposals on whether they respect the documented limits, because a Function that exceeds them does not error. It silently does nothing.
What the decision rests on
- Functions are compiled to WebAssembly and run on Shopify's infrastructure. The documented limits for carts up to 200 lines are 11 million execution instructions, 128 kB of input and 20 kB of output, with a compiled binary cap of 256 kB.
- The input query is capped at 3,000 bytes with a maximum calculated cost of 30, and metafield values over 10,000 bytes are not returned.
- Separate Function APIs cover discounts, cart transform, delivery customization, payment customization and cart and checkout validation, among others.
- A store can have at most 25 active discount Functions, and delivery customization can hide, rename or reorder existing rates but cannot create new ones.
- Custom apps containing Functions are limited to Shopify Plus stores, while public apps can bring Functions to other plans. Functions cannot use clocks or randomness; time-dependent values must be passed in as data.
Match the job to the right Function API
Discounts, bundles, delivery, payment and validation are separate APIs with separate activation methods and per-store caps, such as 25 active discount Functions. A proposal that just says Functions without naming the API has not been scoped yet.
Ask how it behaves at 200 lines
Limits scale with cart size, and a rule that passes on a 3-line test cart can exceed the instruction budget on a wholesale order. Ask for the test cart sizes used, and what happens on failure: the documented behavior is default pricing, silently.
Check the plan gate before commissioning
Custom apps containing Functions are for Shopify Plus stores. On other plans you are buying a public app's configuration, not custom code. That changes the price, the timeline and what rules are even possible.
Keep configuration out of the binary
Tier tables and thresholds should live in metafields the Function reads, so changing a number is a data edit. If every threshold change needs a deploy, the build will ossify and the business will route around it with discount codes.
Two of those facts do most of the work in this decision. Functions are compiled to WebAssembly and run on Shopify's infrastructure. The documented limits for carts up to 200 lines are 11 million execution instructions, 128 kB of input and 20 kB of output, with a compiled binary cap of 256 kB. And: A store can have at most 25 active discount Functions, and delivery customization can hide, rename or reorder existing rates but cannot create new ones. A vendor or setup that handles those two well and the rest adequately will outperform one that demos beautifully and fails both, every quarter it runs.
Related reading
Readers working through “How to choose Shopify Functions: the checks that matter before you commit” often find these earlier guides useful as well: Restocking Fees Fail on Disclosure, Not on Size, A Chargeback Is Not a Return: Friendly Fraud Wears a Returns Costume, and Velocity Limits for Returns: Slowing Repeat Abuse Without Punishing Good Customers.
Frequently asked questions
How many discount Functions can a store run?
At most 25 active discount Functions. Delivery, payment and validation customizations have their own caps, also 25 each in Shopify's documentation. Consolidating rules into fewer Functions is usually better than one Function per promotion.
What happens if a Function exceeds its limits?
Shopify cancels the run and applies default behavior: the discount does not apply, the full payment list shows. There is no customer-facing error, which is why testing at realistic cart sizes matters more than testing the happy path.
Can delivery customization create a custom shipping rate?
No. It hides, renames or reorders rates that already exist from your shipping zones or a carrier service. Creating a new rate is a carrier service's job. Scoping a Function to invent rates is a project that fails at build time.
Where should discount thresholds live?
In metafields the Function reads through its input query, not compiled into the binary. Then a tier change is a data edit anyone with admin access can make, instead of a deploy that waits on a developer.