Discussing APIs and development related to customers, discounts, and order management.
Hi,
So I have created Shopify app using functions and Discount code created. Now when I am trying to get Discount code using Graphql it always return null. I am using "codeDiscountNode" and discount code gid to get discount code using Graphql.
Can anyone please help why it is always returning null.
Solved! Go to the solution
This is an accepted solution.
So for anyone who is trying to find I used code of `app.volume-discount.$functionId.$id.jsx` from here https://github.com/Shopify/function-examples/tree/main/sample-apps/discounts/app/routes and its working for me.
Thanks.
Hi Agandhicb,
Do you have the read_discounts
access scope enabled?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi Liam,
Thanks for helping me.
App which I created have read_discounts scope in shopify.app.toml file. Screenshot below.
Do I have to enable read_discounts somewhere else?
Thank
Ankur
Also I found that discount code created by app are returning null. If I used same graphql with other discount code (Not created by app) then it is returning results.
Which app is creating the discounts? It sounds like there could be some implementation issue related to the discounts created by an app (or permissions issue). Are there any errors being logged?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi Liam,
Thanks for reply.
I have created shopify app which discount products If quantity is 3 or more in cart.
I have created this app using https://shopify.dev/docs/apps/selling-strategies/discounts/experience/getting-started
I can create discount code and discount code is applied to cart properly. Now as we have add discount code feature in admin side, I just want to edit discount code for my app and So I am trying to get discount code details using Graphql
In short I am trying to make "app.volume-discount-one.$functionId.$id.jsx" file work to edit discount code and it is not working.
I have checked and no errors logged (Screenshot below)
Below is screenshot which shows scopes for app I have created
THanks for help, I am stuck here and not able to figure out how to edit discount coupon created by my app using interface created in my app.
Thanks.
This is an accepted solution.
So for anyone who is trying to find I used code of `app.volume-discount.$functionId.$id.jsx` from here https://github.com/Shopify/function-examples/tree/main/sample-apps/discounts/app/routes and its working for me.
Thanks.