I am developing a simple app that will allow me to specify a web link in a product description. Based on initial research, it seems the best way is to use a metafield. I have working code to create the metafield, but I would like to be able to pre-populate the edit box in the app when navigating from the product page of the test store. I can see the product id in the URL, but it is not getting passed to my app at all. Is there any tutorial of setting up context from the product page? I want to edit the field directly on the product page if possible. Everything has been really easy except for the last step, I've spent 2 days fruitlessly searching for the answer to this, and I'm starting to think the only solution is to replicate the entire product creation page in the app? That's not what I want to do...
Hi @CelloG ,
From reading your post, one thing I need to warn about is that Shopify will prevent you from making Admin API requests (e.g. like creating a metafield for a product) from your front-end online storefront webpage. Shopify will throw a CORS error preventing you from making this API request, and also it is very dangerous to do this because it means that your API Keys and Secrets will be available to anyone who inspects the webpage or opens up the Developer Console in the browser. Any Admin API requests you make must be done on the back-end from your app's server/host.
Hassain | Developer Support Specialist @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
found a workaround: I can just set the metafields directly for all of the products with
I've managed to get that into the confirmation email, now I'm struggling with inserting it into the order status page. Will open a new thread for that one.