New discount function and settings extensions - missing docs?

Hi,
I am attempting to create a discount function (the new api),
with a discount function settings extension (block, ui extension).
Perhaps regardless to the new discount function api,
Using the example from the docs, i noticed it doesnt use the new discount api, but product discount.
When trying to save a new discount shopify showed an error:

Functions configured to use the discounts API type require the discountClasses field to be set.

The docs show that when using metafieldDefinitionCreate it accepts ownerType: "DISCOUNT",
but I couldn’t find something about discountClasses.

Hey @Daniel_Rashi :waving_hand: - I can’t say for certain what’s causing this, but I do know that this issue has popped up before when it comes to the new Discounts API. This thread here mentions a similar issue: discountAutomaticAppCreate mutation broken in all API versions prior to 2025-04

I’m wondering if the discount that was being used in your function there hadn’t had any classes defined. The classes field was added recently though (in API version 2025-04), so if you were using an earlier version, this could be why the initial classes input field didn’t pop up when the discount itself was created.

If you’re still encountering the issue, could you share an X-Request-ID from an API response header for an example of the error and I can take a look at our logs to see why the issue is popping up if it isn’t your configuration?

Hope this helps - let me know if I can clarify anything on my end here :slight_smile:

1 Like

Yup I ran into this same issue.

Either use the deprecated discount function types, or switch to the new general discount function API, but make sure you use the 2025-04 and later API versions to create the discount node.

It’s just an API change that is a bit confusing to work around.

Hi,
this is what i get in network :


Screenshot 2025-05-06 at 14.23.02

@Moshe_Cohen

As mentioned in this thread, you’ll need to use the 2025-04 Admin API in order to create a discount node of that type.

If you create a deprecated dedicated discount/product/shipping discount function, then those are compatible with the < 2025-04 Admin API when creating the discount node.

My solution was to only use the 2025-05 when creating the discount node, until I’m ready to upgrade the rest of my app.

1 Like