0
votes

Our Shopify app is activated by adding our snippet into the product and cart liquid files.

We noticed that adding the snippet is a tricky part for most merchants and we would like to offer them an option that we would do the heavy lifting for them.

My questions:

  1. What is the best practice for doing such action?
  2. How we can go on preview mode and wait till the merchant accept the change?
  3. Any code samples using the Shopify Python SDK will be highly appreciated.

Thanks!

1

1 Answers

0
votes

Here is a pattern that will work, and cause the least damage on uninstall.

  • download product.liquid using API (have fun ensuring you get the one that matters, as it could be in sections or snippets now)
  • inject your special codes in that snippet
  • upload your modified product.foobleflap.liquid

So now all your merchant need do is substitute your Liquid file for the original one. On App uninstall, no kittens have been killed, they need to simply revert back to their original Liquid file

Of course there are other patterns, but modding their original file with your snippet is probably least desirable from an uninstall perspective, as they would have to manually erase traces of your code.