November 5, 2026 · 8 min read

Why Your Migrated Discount Function Silently Returns Nothing (And How to Debug It)

Shopify Scripts stopped executing on June 30, 2026. If your replacement Discount Function deploys fine but applies nothing at checkout, here are the exact

Why Your Migrated Discount Function Silently Returns Nothing (And How to Debug It)

Deploying a Shopify Discount Function successfully does not mean it is running. The build passes, the app installs, and checkout completes at full price with zero error messages. That is the defining characteristic of this failure class: it is silent by design, because checkout is not supposed to crash when a discount engine returns nothing.

Since Shopify Scripts stopped executing on June 30, 2026, every store that migrated under time pressure has at least one of the five failure modes below. I have debugged variants of all five across stores with complex tiered pricing. Here is exactly what to look for.

Key takeaways

  • A Function that deploys correctly still does nothing until an Active discount node exists in the Admin and is attached to it.
  • Every field your Ruby Script read must appear in input.graphql or it comes back null, silently flipping your condition.
  • combinesWith is set on the discount node, not in your Function code; a misconfigured node means only one of two stacked discounts fires.
  • Functions run concurrently and have no knowledge of each other; selectionStrategy governs which candidate wins within one Function, not across the whole store.
  • The 2026-04 GraphQL API version added full discount-allocation visibility at cart, line-item, and delivery-group levels, so if you are on an older API version you are missing data your logic depends on.

The timeline, briefly

Shopify announced the Scripts deprecation deadline was April 15, 2026 for editing or publishing Scripts, with a hard execution cutoff of June 30, 2026. The deadline had been extended twice before (originally August 2024, then August 2025) before Shopify confirmed June 30, 2026 was final. Stores that did not migrate saw their discount, shipping, and payment logic go silent at checkout with no storefront warning and no admin banner.

If you are reading this after July 2026, your Scripts are definitely no longer running. The question is whether your replacement Functions are.

The five silent failure modes

1. The Function is deployed but no discount node exists

This is the most common cause I see. A Function does not execute on its own. It only runs when a DiscountAutomaticApp or DiscountCodeApp node exists in the Admin, is set to Active, and has the Function attached to it.

You can create the node in the Admin under Discounts > Create discount > [your app], or via the discountAutomaticAppCreate GraphQL mutation:

mutation {
 discountAutomaticAppCreate(automaticAppDiscount: {
 title: "Tiered Volume Discount"
 functionId: "YOUR_FUNCTION_ID"
 startsAt: "2026-07-01T00:00:00Z"
 combinesWith: {
 orderDiscounts: true
 productDiscounts: false
 shippingDiscounts: true
 }
 }) {
 automaticAppDiscount {
 discountId
 }
 userErrors { field message }
 }
}

How to verify: Go to Admin > Discounts. If there is no row for your Function-backed discount, or the status shows as Scheduled rather than Active, the Function is not being called.

2. A required field is missing from input.graphql

This is the subtlest failure. Your Function logic is correct, but the branch it evaluates reads a field that is null because you never requested it in input.graphql. The Function silently takes the wrong path and returns no discount.

Every conditional in your Script has a corresponding field that must appear in the input query. Common omissions after migration from Ruby:

  • cart.buyerIdentity.customer.hasTags (customer-tag-gated discounts)
  • lines[].merchandise.product.inAnyCollection (collection-based pricing)
  • discountNode.metafield (configuration stored on the discount node itself)
  • lines[].sellingPlanAllocation (subscription products that should be excluded)

A concrete example: if your Script gave a 15% discount to customers tagged vip, your replacement Function needs this in input.graphql:

query Input {
 cart {
 buyerIdentity {
 customer {
 hasTags(tags: ["vip"])
 }
 }
 lines {
 id
 quantity
 merchandise {
 ... on ProductVariant {
 id
 price { amount }
 }
 }
 }
 }
 discountNode {
 metafield(namespace: "$app:discount", key: "configuration") {
 value
 }
 }
}

If hasTags is absent, the field returns null, your condition evaluates to false, and the Function returns { discounts: [], discountApplicationStrategy: FIRST }. No error. No log line visible in a standard deploy.

How to verify: Run shopify app function run locally with a sample payload that matches a cart that should get a discount. Inspect the raw input JSON and confirm every field your logic branches on is present and non-null.

3. combinesWith is misconfigured on the discount node

If you migrated a Script that applied both a line-item discount and an order-level discount, and you rebuilt them as two separate Functions, you now have two discount nodes. Whether both fire depends entirely on the combinesWith settings on each node.

All discount Functions run concurrently and have no knowledge of each other. The Shopify discount engine then applies combinability and stacking rules after collecting all candidates. An Order Discount can stack with a Shipping Discount, but two Order Discounts cannot apply to the same checkout. Product plus Order plus Shipping can all combine if each node is flagged to allow it.

The rule that breaks migrations most often: combinesWith is set on the discount node in the Admin, not in your Function code. Many teams configure the Function logic correctly, then leave the node at its default (no combinations allowed), and wonder why only one of their two discounts fires.

Discount class combinationAllowed by defaultNotes
Product + OrderNo (opt-in)Set productDiscounts: true on the Order discount node
Product + ShippingNo (opt-in)Set shippingDiscounts: true on the Product discount node
Order + ShippingNo (opt-in)Set shippingDiscounts: true on the Order discount node
Order + OrderNeverOnly one order discount slot per checkout, regardless of settings
Shipping + ShippingNeverOnly one shipping discount per order

How to verify: In Admin, open each discount node, go to Combinations, and confirm the checkboxes reflect your intent. For mutations, inspect the combinesWith field on the DiscountAutomaticApp or DiscountCodeApp node via the GraphQL Admin API.

4. Hitting the per-store active discount limit

Shopify caps active automatic discount Functions at 25 per store (confirmed in the Discount Function API docs). That cap is shared across all installed apps and your own custom apps combined. On stores with many apps, the limit is real.

There is a subtler limit that catches migrating stores: the community has documented a 5-active-app-generated automatic discount cap that surfaces independently of the documented 25 limit, particularly when multiple apps each create their own discount nodes. If you have several discount apps installed alongside a custom Function, you may hit contention here.

Symptoms: a discount node exists, it is Active, combinesWith is correct, but the Function appears not to run for some carts. Check your total active automatic discount count in Admin > Discounts, filtering by Automatic.

5. API version mismatch in the input schema

As of GraphQL API version 2026-04, Shopify Functions can read discount allocations at the cart, line-item, and delivery-group levels directly from the function input payload. Functions that execute after discount application in the checkout pipeline receive complete allocation data; those that run earlier do not.

If your Function is pinned to a pre-2026-04 API version, you are missing fields that exist in the current schema. The Function will not error; the fields simply return null. This matters most when your Function logic is conditional on what other discounts have already applied (for example, "only apply my loyalty discount if no promotional discount is already active on this line").

How to verify: Check the api_version field in shopify.extension.toml. Bump it to 2026-04 or later, regenerate types with shopify app generate extension, and diff the generated input.graphql types against your current query to find newly available fields.

Migration approach comparison

ApproachWhen to useMain trade-off
Native Admin discount (BOGO, volume)Standard BOGO or volume break, no custom conditionsZero dev work; limited logic depth
Public App Store app on FunctionsCommon patterns (tiered pricing, free gift, bundles)Faster to deploy; you depend on the app vendor's update cadence
Custom Function (JS/TypeScript)Moderate complexity; team is comfortable with JSNeeds Plus for custom apps; 10-30ms real-world execution
Custom Function (Rust/Wasm)High complexity, large carts, tight execution budgetsFaster (3-5ms); steeper learning curve; compiled to WebAssembly

Execution order matters

Functions do not all run at the same moment in the checkout pipeline. The documented order is: Cart Transform Functions first, then Discount Functions. If your discount depends on transformed cart lines (for example, a bundle merge done by Cart Transform), and your Discount Function runs before the transform is complete, it will see the pre-merged cart.

Design Discount Functions to operate on the cart state after Cart Transform, and test with a full checkout flow, not just unit tests against a static cart payload.

Debugging checklist

Run through these in order before touching any code:

  1. Confirm the discount node exists and is Active in Admin > Discounts.
  2. Confirm the Function ID on the node matches the deployed Function. Redeploy after a Partner Dashboard app reset can change the Function ID.
  3. Diff input.graphql against every field your logic reads. Any field read in JS/Rust but not in the query is null.
  4. Run shopify app function run with a cart payload that should trigger the discount. Inspect the raw output object. If discounts is an empty array, the Function ran but returned nothing; if the command errors, the Function failed.
  5. Check combinesWith on every discount node involved in the same checkout.
  6. Check the active automatic discount count against the 25-Function limit.
  7. Confirm the API version in shopify.extension.toml and regenerate types.

For a worked breakdown of how to configure Functions with metafields so discount rules change without redeployment, the lintelagency.com/journal post on configuring Functions with metafields covers the configuration pattern in detail.

A note on the stacking model change

One thing worth flagging: some of the migration guides written before mid-2026 describe a hard one-discount-per-line-item ceiling as a permanent Functions limitation. That ceiling was revised in mid-2026. Multiple product discounts can now combine on the same line item when combination settings are explicitly enabled on each discount node. If your migration guide predates that change, re-read the combination section of your discount nodes before concluding that two product discounts cannot coexist.

The mechanics to check remain the same: combinesWith on the node, the discount class (product, order, or shipping), and the store-level 25-Function cap.

Conclusion

Every failure mode above produces the same symptom: checkout completes, the customer pays full price, no error surfaces anywhere. The diagnostic loop is fast once you know what to check. Start with the discount node in Admin, work through the input query field by field, then verify combinability settings. The Function code itself is usually not the problem. The configuration surrounding it is.

If you would rather hand this off, my studio Lintel offers Shopify Functions development.

Frequently asked questions

Why does my Shopify Discount Function deploy without errors but apply no discount?

The most common causes are that no Active discount node is attached to the Function in the Admin, or that a field your logic depends on is missing from input.graphql and returns null. Run shopify app function run locally with a real cart payload to see exactly what the Function receives and returns.

What is the difference between selectionStrategy and combinesWith in Shopify Functions?

selectionStrategy (FIRST, MAXIMUM, or ALL) controls which candidate discount your Function picks internally when it evaluates multiple possible line targets. combinesWith is set on the discount node in the Admin and controls whether that discount can stack with discounts from other nodes at the checkout level. They are completely separate settings.

How many Discount Functions can be active on one Shopify store?

Shopify allows a maximum of 25 active discount Functions per store, shared across all apps and custom Functions combined. Customers can apply up to 5 product or order discount codes plus 1 shipping discount code per order, and those limits are enforced on top of the Function cap.

Seven years of Shopify, on one page.

Roles, projects, stack and certifications are on the resume.

Resume Download PDF LinkedIn