Using Discount function without any configuration from the merchant?

Hi, just tried to play a little with the new function API.

I want to set a discount, by using some products metafields from my app and without any (more) configuration than the merchant already set trough.

i tought it was possible, (and for me it’s the purpose of using function) but even after deploy it on my dev store / and tested it with https://github.com/Shopify/function-runner nothing happens, and nothing too on extensions dashboard, nothing is triggered !

I’ve read this post https://community.shopify.com/c/shopify-functions/how-do-i-test-my-shopify-function/td-p/1802721 seems to have the same problem.

So it’s mandatory to have some configuration from the merchant ? it would drastically reduce the point of using Shopify Functions in my opinion ? or am i missing something ?

Thanks

Finally found out i just needed to create a discount code from app with function ID :slightly_smiling_face:

https://shopify.dev/api/admin-graphql/2023-01/mutations/discountAutomaticAppCreate

1 Like

Where do you add this mutation?