I am building an app for shopify using PHP. I need to fetch current Theme’s Id and secondly i need to inject snippet. I am not sure about how to use Shopify Assests/Api. Can someone help me to solve these issues
I am building an app for shopify using PHP. I need to fetch current Theme’s Id and secondly i need to inject snippet. I am not sure about how to use Shopify Assests/Api. Can someone help me to solve these issues
2
Answers
Here is the Code i am using Please make me correct.
Shopify presents you with an endpoint labelled Theme. Use that to query for all the themes in a shop. You can check them for the one set as the main or current theme. Once you find the main, published theme, you can then use the ID of that theme to GET and POST assets, such as your snippet.
As for not being sure about how to make secure Rest calls to the Shopify API, there are a million tutorials out there showing you how to do that. Shopify is the same as any other major web property in this respect. Nothing crazy to learn there but oAuth.