DiscountApplicationStrategy.All is not a recognized option for new scaffolded product-discount

Topic summary

Issue: Developers attempting to use DiscountApplicationStrategy.All in product-discount Shopify Functions received an InvalidOutputError (discountApplicationStrategy expected non-null). Initial setups showed mixed API versions (app 2024-01 vs extension 2023-10), and manually updating the extension’s api_version didn’t resolve it.

Context: DiscountApplicationStrategy determines how multiple discounts combine (FIRST, MAXIMUM, ALL). Shopify’s changelog states ALL is supported from 2024-01 for the Product Discount Function API.

Guidance: A maintainer advised fully upgrading the extension to a newer API version and pulling the latest function schema per Shopify’s upgrade steps (ensuring the function’s schema reflects the new capabilities).

Follow-up: Another developer reported the same error on 2024-07, suggesting only FIRST and MAXIMUM were accepted despite updated dependencies and API version.

Latest outcome: The original poster confirmed that as of the April release, DiscountApplicationStrategy.All works. They shared a working return payload including discountApplicationStrategy: DiscountApplicationStrategy.All.

Status: Partially resolved. Evidence suggests ALL works with the updated schema/API post-April, but at least one user still experiences the null error. Key next step is confirming schema pull and function rebuild against the target API version.

Summarized with AI on December 25. AI used: gpt-5.

I scaffolded a new product-discount extension function today and the shopify.app.toml file reflects api-version 2024-01 and the shopify.extension.toml file shows api_version 2023-10. The product-discount package.json shows app and cli versions 3.53.0.

I would like to use the new discountApplicationStrategy of All per https://shopify.dev/changelog/new-discountapplicationstrategy-option-for-product-discount-function-api which states: EFFECTIVE JANUARY 01, 2024 The Product Discount Function API now supports setting discountApplicationStrategy to “ALL” in the FunctionRunResult.

Unfortunately, All is not a recognized discountApplicationStrategy option. I tested in my actual function code on a test store which confirms that upon running the app, All is not a recognized discountApplicationStrategy option.

InvalidOutputError

[

{

“path”: [

“discountApplicationStrategy”

],

“explanation”: “Expected value to not be null”

}

]

I attempted to manually modify the shopify.extension.toml file to use api_version 2024-01, re-ran the dev command and tested, but the same behavior occurred. How do I update my function to use the new discountApplicationStrategy of All?

If you are upgrading an extension to a new API version, be sure you’ve followed all the steps here, including pulling the latest schema:

https://shopify.dev/docs/apps/functions/input-output#api-versions

1 Like

Hello!

I am experiencing an issue similar to the one described in this post regarding the use of the DiscountApplicationStrategy.All in Shopify Functions. Despite updating to the 2024-07 version as suggested in the solution, the problem persists.

The error message I’m encountering is:

[  {    "path": [      "discountApplicationStrategy"    ],
    "explanation": "Expected value to not be null"
  }
]

It appears that DiscountApplicationStrategy.All is still not recognized or correctly implemented. Shopify only seems to accept FIRST and MAXIMUM as valid options, not ALL.

have ensured that all dependencies are up-to-date and that I am indeed using the 2024-07 API version. Despite these efforts, the error persists, preventing the application of multiple discounts.

Any guidance or suggestions on resolving this issue would be greatly appreciated.

DiscountApplicationStrategy.All has worked for me as of the April release. Below is a snippet of my return code if it helps.

return {
      discounts: [
        {
          targets: targets0, // Apply the discount to the collected targets
          value: {percentage: {value: discount0}} // Define a percentage-based discount
        },
        {
          targets: targets1,
          value: {percentage: {value: discount1}}
        },
      ],
      discountApplicationStrategy: DiscountApplicationStrategy.All
    };
1 Like