Discount Creation Error: “discountClasses Field Not Defined” When Migrating to New Discount API

Hi Shopify developers,

We’re currently migrating our app’s discount functionality to use the latest [Discount API] and the discountAutomaticAppCreate mutation with Shopify Admin API (version 2025-04). For our new function-based discounts, we’re using the mutation with the required fields, including discountClasses as recommended in documentation and as supported in the GraphQL explorer. However, we’ve run into an issue:

Whenever we try to create a discount via our app with a mutation like:

graphql

mutation CreateAutomaticDiscount($automaticAppDiscount: DiscountAutomaticAppInput!) {
  discountAutomaticAppCreate(automaticAppDiscount: $automaticAppDiscount) {
    automaticAppDiscount {
      title
      discountId
    }
    userErrors {
      code
      message
      field
    }
  }
}

and pass discountClasses as a field in the variable payload (e.g. discountClasses: ["PRODUCT", "ORDER"]), we get the following error from the Admin API:

text

Variable $automaticAppDiscount of type DiscountAutomaticAppInput! was provided invalid value for discountClasses (Field is not defined on DiscountAutomaticAppInput)

Strangely, when we run an inline mutation in the GraphQL app/playground, everything works as expected and the discount is created with the specified classes.

For legacy discounts (older functions not yet migrated), we’re still using the older automaticAppCreate mutation, which works fine without this field.

Questions:

  • Is this a known issue with the Admin API’s variable payload validation for discountClasses?
  • Is there an official roadmap or best practice for ensuring discountClasses works in both inline and variable payloads?
  • Does anyone have experience resolving this or know of any workarounds that work for production apps?
  • Should we just omit discountClasses for now in variable payloads and rely on defaults, or is there a way to fully define the discount type?

Any advice for developers migrating to the new Discount API and managing old discounts with legacy mutations would be greatly appreciated.

Thanks!

We’re eager to hear from anyone who has encountered or resolved this!

We’ve resolved the issue with discount creation on the new Discount API—turns out our app version hadn’t updated properly. After switching to Admin API version 2025-04, the mutation works as expected with the required fields.

However, we still have older automatic discount functions in our app that have not been migrated to the new Discount API. For these, we’re using the legacy automaticAppCreate mutation.

Question:

Is it safe and compatible to continue using the older automaticAppCreate mutation for functions that haven’t been migrated, while using the new discountAutomaticAppCreate mutation for newer functions with the 2025-04 API? Will both approaches work side-by-side until all discounts are migrated, or are there any compatibility considerations, caveats, or known issues we should be aware of?

Any advice or experience from developers running both approaches in parallel—or guidance from Shopify staff—would be greatly appreciated.

Thanks!

Hi @Shrutika_Lokhande

Glad you figured out the solution to your main issue. It should be safe to use the two different mutations side-by-side for now - that’s generally an advised model for progressively migrating to a different model.