DiscountCodeApp / DiscountAutomaticApp ignores appliesOnSubscription

I’m running into a consistent issue with both DiscountCodeApp and DiscountAutomaticApp.

If I configure a discount with:

appliesOnSubscription: false

I expect my discount Function to NOT execute when a subscription product is present in the cart.

However, the Function is still triggered and the discount is evaluated/applied, even when the cart contains subscription items.


At the moment, the workaround we are using is to manually detect subscription items inside the Function by checking:

sellingPlanAllocation.sellingPlan.recurringDeliveries

While this works, it forces me to:

  • Add extra fields to the GraphQL input query

  • Add additional logic to the Function

  • Increase instruction count, query cost and input size

This is becoming a real performance concern for large carts — for example, we’re hitting instruction count limits when the cart contains ~70 line items.


Is there any way to make the appliesOnSubscription: false flag work as expected / is there a Shopify-side fix planned for this issue?

I’d really appreciate clarification on this.

Hi @shaheem

From digging into this, it looks like this is not a bug and it’s expected that you can’t prevent your Shopify Function from executing based on the appliesOnSubscription: false setting alone. The appliesOnSubscription flag is used by Shopify to determine whether a discount should be available for subscription products, but it does not prevent the function from being invoked when subscription items are present in the cart.

This means you must add extra fields to your GraphQL input query to detect subscription lines, and then build logic to your function to skip or filter out subscription lines.

If you’re hitting instruction count limits, you may need to optimize your function logic as much as possible, or look into splitting the logic into multiple functions if possible.

1 Like

appliesOnSubscription: false currently does not stop a DiscountCodeApp or DiscountAutomaticApp Function from being executed. It only prevents the discount from being applied, not the Function from running. That’s why your Function still triggers when subscription items are in the cart.

Right now, the only reliable workaround is exactly what you’re doing detecting subscription items inside the Function via sellingPlanAllocation. Unfortunately, there’s no Shopify-side fix available yet, and no way to prevent the Function from executing at the platform level.

If performance is a concern for large carts, the best approach is to minimize the input query and simplify subscription checks until Shopify updates this behavior.