October 7, 2026 · Ahmed · More by Ahmed
Shopify Functions Run in a Fixed Order During Checkout
Shopify Functions execute in a fixed 17-step order during checkout — and the resource limits every function shares, regardless of position.

The 17 Steps, In Order
Shopify's Function APIs documentation lays out a fixed execution order that every checkout follows once more than one function type is installed. Functions that change the pricing and presentation of cart lines run first, then functions that calculate discounts, and only at the very end do validation functions run. The full sequence, as published in Shopify's reference docs: Cart lines, Cart Transform, Cart line discounts, Discount, Fulfillment groups, Fulfillment Constraints, Order Routing, Delivery methods, Pickup Point Delivery Option Generator, Local Pickup Delivery Option Generator, Delivery Customization, Delivery discounts, Discount, Payment methods, Payment Customization, Verification, and Cart and Checkout Validation.
This is easy to miss because each Function API — Cart Transform, Discount, Delivery Customization, Fulfillment Constraints, Payment Customization, Cart and Checkout Validation — ships its own reference page. The cross-API order lives in one shared doc that a team building just one function type rarely has reason to open.
Why Validation Always Runs Last
Shopify's docs state the reasoning directly: "a cart validation function can't run until after discount calculations are complete." A Cart Transform that merges or expands line items has to finish before discount functions calculate what to discount, and a Cart and Checkout Validation function only ever sees the cart after every upstream discount, delivery, and payment function has already acted on it. Stack a bundling cart-transform with a discount function and a validation rule in the same app, and this order — not just the order you wrote the code in — determines what data is actually available, and valid, at each step.
The Limits Every Step Shares
Wherever a function sits in that order, it's bound by the same resource ceilings: a 256 kB compiled binary, 10,000 kB of runtime linear memory, 512 kB of runtime stack, and 1 kB of truncated logs. For carts up to 200 line items, execution is capped at 11 million instructions, with 128 kB of input and 20 kB of output — a limit the docs note "doesn't support bulk price transformations across all line items." Input queries are capped at 3000 bytes and a calculated cost of 30, where fields like hasTags, hasAnyTag, inCollections, inAnyCollection, or anything returning a Metafield object cost 3 each.
Worth tracking separately: target and operation names were standardized across six Function APIs for version 2025-07 and later. Cart Transform's purchase.cart-transform.run became cart.transform.run, and Cart and Checkout Validation's purchase.validation.run became cart.validations.generate.run — names that now map directly onto each step's place in this order.