shopify - Include Snippet programatically on app install
I have an app that I am using on Shopify store. When I install it i have used assets api to create a snippet file. Everything works fine. What I am trying to achieve is that whenever user install my application the app snippet which is created should be included automatically on product-template.liquid file on a desirable place (e.g above add to cart button). What i have done is I have used again assets api to get the page data and I am trying to place my code that will include that snippet but I am not sure how to specify position where to add that code.
Solution: I did it by getting page as a string via assets Api and then by getting position i updated it with my line of code
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.