Shopify Functions run your own logic inside Shopify’s backend: discounts, delivery options, payment methods, cart validation and more. They are fast and they are native to checkout, but they run inside tight resource limits. When those limits move, the set of things you can sensibly build as a function moves with them.
what changed in the functions limits?
Shopify has raised some of the resource limits that apply to functions. The practical effect is that logic which previously had to be trimmed, split or handed to an external app now has more room to run in a function.
We don’t restate the numbers here. They differ by function API, they are documented in the Functions reference, and they change. Read the current limits before you design against them, and design with headroom: a function that runs at the edge of its budget on a normal cart will fail on a large one.
who it touches
- Stores running a third-party app for tiered, bundle or customer-specific discounts.
- Stores with delivery rules that hide, rename or reorder shipping options based on cart contents, location or customer tags.
- Wholesale and B2B stores with pricing rules that depend on many lines or many customer attributes.
- Anyone who previously ruled out functions because a large cart blew the input or execution limit.
when should a function replace an app?
Replacing an app with a function is not automatically a win. It is a win when the logic is stable, well understood and specific to your store.
- List what the app actually does. Not the feature list, the rules you have configured. Often it is a few rules out of a large product.
- Check the data the rule needs. Functions read a declared input query: cart lines, customer, metafields and so on. If a rule depends on data that lives outside Shopify, you need to bring it in as metafields first, or a function is the wrong tool.
- Prototype the worst cart. Build the function against your largest realistic cart, not the average one. That is where limits bite.
- Compare total cost. An app fee against build and maintenance time, plus the version upgrades functions need like any other API consumer.
- Run both, then cut over. Ship the function to a dev store, compare results against the app on the same carts, then switch.
// Keep the input query narrow: every field you ask for counts against the input budget.
// Read thresholds from configuration, not constants in code.
export function run(input) {
const qty = input.cart.lines.reduce((n, line) => n + line.quantity, 0);
const tier = pickTier(readConfig(input), qty); // config lives in a metafield
if (!tier) return NO_CHANGES;
return buildDiscount(tier);
}
checklist
- The rules configured in the current app are written down.
- Every data source for those rules is available inside Shopify.
- The prototype is tested on the largest realistic cart.
- Cost is compared over a year, including upgrades.
- Both run in parallel on a dev store before cut-over.
impact
Worth knowing. Nothing breaks. But if you pay for an app to run a handful of rules, this is a good moment to reconsider.