How can I create a custom automatic discount with only "product" as discountClass?

discountAutomaticAppCreate API incorrectly adds “ORDER” to discountClasses when only “PRODUCT” is specified (API 2025-07)

Problem Description

I’m experiencing an issue with the discountAutomaticAppCreate GraphQL mutation in API version 2025-07 where specifying discountClasses: ["PRODUCT"] results in the discount being created with discountClasses: ["PRODUCT", "ORDER"] instead.

Expected Behavior

When creating an automatic discount with discountClasses: ["PRODUCT"], the discount should be created with only ["PRODUCT"] in its discountClasses array.

Actual Behavior

The discount is created with ["PRODUCT", "ORDER"] in the discountClasses array, even though I only specified ["PRODUCT"].

Impact

This causes my discount to fail to combine with other product discounts that have combinesWith.orderDiscounts = false. These other discounts reject combination with my discount because Shopify treats it as being compatible with order discounts due to having “ORDER” in its discountClasses.

Steps to Reproduce

1. Create an automatic discount using the following mutation:

graphql

mutation CreateDiscount($discount: DiscountAutomaticAppInput!) {
  discountAutomaticAppCreate(automaticAppDiscount: $discount) {
    automaticAppDiscount {
      discountId
      discountClass
    }
    userErrors {
      field
      message
    }
  }
}

Variables:

json

{
  "discount": {
    "title": "Product Only Discount",
    "functionId": "YOUR_FUNCTION_ID",
    "startsAt": "2025-10-29T00:00:00Z",
    "discountClasses": ["PRODUCT"],
    "combinesWith": {
      "productDiscounts": true,
      "orderDiscounts": false,
      "shippingDiscounts": true
    }
  }
}

2. Query the created discount to check its discountClasses:

graphql

query {
  discountNode(id: "DISCOUNT_ID") {
    discount {
      ... on DiscountAutomaticApp {
        discountClass
      }
    }
  }
}

3. Result: The discountClass returns ["PRODUCT", "ORDER"] instead of ["PRODUCT"]

Additional Context

  • My Shopify Function only returns productDiscountsAdd operations (no order or shipping discount operations)

  • My function targets only cart.lines.discounts.generate.run

  • I do not have a UI extension for this discount (creating programmatically via API only)

  • Important: When querying existing custom automatic discounts in my store, I can see other discount nodes that have only ["PRODUCT"] in their discountClasses, which confirms this configuration should be possible

Environment

  • API Version: 2025-07

  • Function Target: cart.lines.discounts.generate.run

  • Creation Method: API only (no UI extension)

Question

How can I create an automatic discount via the API that has only ["PRODUCT"] in its discountClasses array? Is this a known issue or is there a specific way to achieve this configuration?

Any help would be greatly appreciated!

1 Like

Hey @Guido_van_Loon , I’ll look in to this for you. Can you share the x-request-id from the response headers of the above mutation?

Can you also share more details about the type of discount this is?

Hi @KyleG-Shopify,

Sorry I forgot about this post.

I just tried it again (on api 2025-07). Apologies for the duplicate information but I don’t quite understand your question about which kind of discount it is. Isn’t that clear from the above? It’s an automatic discount node that is classified as returning product discounts only. Here is another example :
mutation:

mutation createAutomaticAppDiscount($discount: DiscountAutomaticAppInput!) {
  __typename
  discountAutomaticAppCreate(automaticAppDiscount: $discount) {
    __typename
    userErrors {
      __typename
      code
      message
      field
    }
    automaticAppDiscount {
      __typename
      discountId
      startsAt
      endsAt
      discountId
    }
  }
}

variables:

    "discount": {
        "functionId": "...",
        "startsAt": "2025-10-29T19:12:17.965Z",
        "endsAt": null,
        "title": "Test",
        "discountClasses": ["PRODUCT"],
        "combinesWith": {
            "orderDiscounts": true,
            "productDiscounts": true,
            "shippingDiscounts": true
        }
    }
}

As you can see I am trying to create a automatic discount node which is classified as only returning product discounts.

But the generated node looks like this (so it is classified as returning both product and order discounts):

{
    "id": "gid://shopify/DiscountAutomaticNode/...",
    "discount": {
        "title": "Test",
        "status": "ACTIVE",
        "appDiscountType": {
            "app": {
                "description": null,
                "appStoreDeveloperUrl": null
            },
            "discountClasses": [
                "PRODUCT",
                "ORDER"
            ],
            "functionId": "xxxxx"
        },
        "asyncUsageCount": 0,
        "startsAt": "2025-10-29T19:12:17Z",
        "endsAt": null,
        "combinesWith": {
            "productDiscounts": true,
            "orderDiscounts": true,
            "shippingDiscounts": true,
            "__typename": "DiscountCombinesWith"
        }
    }
}

The associated x-request-id is 8f0cd743-aa47-4967-b97b-cc13e7347181-1762429640.

Let me know if you need any additional information.

Thanks for sharing that Guido. I was able to find that request in our logs and will dig in to see what I can find out from it.

My apologies. What I meant here was more so to understand the logic behind your discount function in case there’s something there that isn’t compatible with a product only discount.

I’ll follow up here once I know more.

Hey @Guido_van_Loon, we have been looking in to this and it does seem like the discount is being created as only Product as you would expect.

Can you test with a query on the discount node that is returning the unexpected result? Once you do that, share the x-request-id of that one so we can review the logs as well.

Hi @Guido_van_Loon Are you still experiencing this issue, or can I mark this as solved?