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.
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
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.
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.