I want to include custom HTML in shopify theme whenever user install / enable my APP in their store. Can anyone suggest me that how to do that ?
Add custom HTML or LiquidThese settings let you safely add custom code to your online store without editing your theme's code directly, which helps to ensure that your theme is eligible for automatic upgrades.
Using the Asset API you can add or update assets, for example your custom HTML. An asset belongs to a theme, so probably you also need the Theme API, which gives you access to the installed theme(s) and it's role(s). You shouldn't update existing assets which don't belong to your own App.
If you only want to add a JavaScript to the store, you might want to use a ScriptTag.
A third option is to use application proxies. Application proxies will forward web requests to your application. Your application returns custom HTML (or Liquid), which will be returned to the visitor. This way you extend the store with for example an image gallery.
Keep in mind assets
won't be removed when the store uninstalls your App. Also after uninstall you don't have access to your assets
anymore. A ScriptTag
will be removed when the store uninstalls your App. For an application proxy you can implement an access mechanism yourself and deny access when the store uninstalls your App.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With