Shopify Discount UI [id].jsx page - How to pull current discount data

Shopify Discount UI [id].jsx page - How to pull current discount data

brentonMN
Shopify Partner
10 0 5

I am building an app to prepare for the new Shopify Checkout. I'm following the dev docs for the Discount UI.

At the moment, I have a discount built and working as per the tutorial. However, the tutorial says to edit the discount, I have to build a [id].jsx page. (Tutorial link: https://shopify.dev/docs/apps/discounts/experience/ui)

 

I have done this. I'm also pulling the form into this page. However, I'm trying to get the discount form values to populate the form since it's not a new discount but an existing one. However, nothing I do pulls any data and throws 404 errors. I'm not finding many resources on the matter.

 

This is the original fetch I'm trying to get working to get the discount values but I receive 404 errors:

 

 

await fetch(/admin/api/2023-01/price_rules/${id}/discount_codes/${id}.json)

 

 



I'm using this also to test but getting 404 errors as well:

 

 

await fetch(/admin/api/2023-01/discount_codes.json)

 

 

Replies 0 (0)