Mistakes · 2026-12-01
Common Shopify Functions mistakes that waste money or cause problems
Function mistakes cluster around one misunderstanding: treating the function like a small server. It is not. It cannot call your systems, it cannot remember anything, and if it runs long Shopify cancels it and quietly applies the default. Teams design a loyalty-aware discount that needs a live balance, or a validation that needs a fraud score, and discover the architecture wall after the build. The wall was in the documentation the whole time.
Designing rules that need data the function cannot reach
The input is a GraphQL query over Shopify objects: cart lines, product and customer metafields, tags, shop data. Anything outside that set is invisible at run time. The fix is a sync: push loyalty balances, warehouse stock flags, or risk tiers into metafields on a schedule, and accept that the function sees the last sync, not the truth.
Where that staleness is unacceptable, the honest answer is that a Function is the wrong tool. A checkout validation that must be current belongs in a pre-checkout step you control, not in a sandbox that cannot phone home.
Ignoring the instruction budget until the big cart arrives
The budget is roughly 11 million instructions for carts up to 200 lines. JavaScript functions carrying heavy libraries burn it fast, and the failure does not announce itself in the admin. It announces itself as a wholesale customer whose tiered discount vanished on their largest order of the year.
Load-test with your real largest carts during development. If the function is near budget, that is a rewrite into Rust or a simpler rule, not a hope. Simpler rules also fail less: a discount ladder with four tiers beats a pricing matrix with forty.
Stacking discount functions without combination rules
Shopify lets product, order, and shipping discounts combine according to combination settings, and up to 25 active discount functions can coexist. Two apps, each reasonable alone, can produce a combined discount nobody intended when a code meets an automatic app discount on a sale item.
Keep a written register of every active discount function, its classes, and its combination settings. Review it whenever an app is installed. The register takes an hour to build and is the difference between a pricing error caught in review and one caught by a customer on social media.
Forgetting that failure is silent and defaults apply
There is no big red banner when a function is cancelled. The discount just does not appear, the hidden payment method just shows, the blocked checkout just proceeds. For validation functions guarding regulated products, that default is the risk case, and it argues for a second control outside the function.
Monitor the outcomes, not the function. Track how often the discount applies, how often the validation blocks, and alert on a drop to zero. Zero usually means cancelled, not cured.
Related reading
For the background behind “Common Shopify Functions mistakes that waste money or cause problems”, these earlier guides help: Box-Free Label-Free Returns: What the QR Code Drop-Off Changes in Your Cost Stack, Returnless Refunds: Run the Threshold Math Before You Offer Them, and Box-Free Label-Free Returns: What the QR Code Drop-Off Changes in Your Cost Stack.
Frequently asked questions
Why did my Shopify Function stop applying its discount?
The usual cause is the instruction budget: on large carts the function gets cancelled and Shopify applies the default, which is no discount. Test with your largest real carts and simplify the rule or move it to Rust.
Can a Function check live inventory or a loyalty balance?
No. Functions have no network access. The data has to be synced into metafields or tags beforehand, and the function works from the last sync. If the rule needs live data, a Function is the wrong tool.
How do discount Functions interact with each other?
Through Shopify's combination rules across product, order, and shipping discount classes. With up to 25 active discount functions possible, undocumented combinations are how stores end up honouring discounts nobody designed.
How do I know if a Function is failing?
Watch outcomes: application counts for discounts, block counts for validations. A drop to zero almost always means the function is being cancelled or an app changed, because the failure itself raises no alert.