automatic discount api how we get function id

automatic discount api how we get function id

Anil918
Shopify Partner
5 0 0

How can we retrieve the function ID when creating a discount app using the Shopify API? I found the discountAutomaticAppCreate mutation documentation here: https://shopify.dev/docs/api/admin-graphql/2025-01/mutations/discountAutomaticAppCreate  but I need clarification on how to obtain the function ID for this process.

Reply 1 (1)

Karoshi
Shopify Partner
4 0 0

You will need to create a extension on your app first, then deploy it since discount function are not able to be created on the Partner app extension.
When extension is created, you can go to the Partner and see you extension functionId here.
Alternatively, on each discount extension, you will need to define the extensions.ui.paths, the :function_id can be pass to the url request when user create discount from the "Admin". When processing the creating discount, we can retrieve this information

Ref the docs: Build a product discount function

Smarty Discounts, expand discounts management features: https://apps.shopify.com/smarty-discount