Hi,
I am looking into converting checkout scripts to functions as scripts will be deprecated August 2025.
When using scripts it was possible to prevent regular discount codes from being applied via the “reject” feature/function. C.f. https://shopify.dev/docs/api/functions/reference/product-discounts the reject feature is not available for functions. The documentation says that the workaround for “reject” not being available in functions is to: “Use a Product discount or Order discount function that contains the necessary logic. For example, you can use conditions to exclude a discount from applying.”
As far as I can see, the discount functions do not have any information about applied discount codes in the input c.f. https://shopify.dev/docs/api/functions/reference/product-discounts/graphql/input, which means I can only prevent the custom discounts in the functions from being applied, but I cannot prevent discount codes from being applied.
If that is correct, it is a problem for our scripts-to-functions-conversion, as I would like to reject all discount codes, if the custom discounts defined in the function applies, to avoid both the custom discounts and the discount codes to apply at the same time.
Anybody knows how to reject discount codes in functions?
Kind regards,
-Louise