Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi,
When my app is installed, i am creating a snippet using the asset api. And rendering that snippet in the theme.liquid file (by using the asset api to update the theme.liquid file).
My problem is when the app is uninstalled, i lose access and i cannot remove the snippet i had added. So, is there any way to stop a snippet from rendering when my app is uninstalled?
I have noticed that when i uninstall some apps, this message is shown in the DOM
<!-- "snippets/example.liquid" was not rendered, the associated app was uninstalled -->
But i wasn't able to replicate the above behaviour with my app. Even after i uninstalled my app, the snippet was still getting rendered. I am not sure if that is because i was testing in a development store. Can anyone please tell me how to replicate the above behaviour or is there any other way to not render a snippet when app is uninstalled?
Thanks
{% if shop.apps['your-app-handle'] %}
<!-- Your snippet code here -->
{% endif %}
In this example, the shop.apps object is used to check if your app is installed on the current store. If it is, the snippet code will be rendered. If not, the snippet code will be skipped and will not be rendered on the page.
It is important to note that the your-app-handle value in the example code should be replaced with the actual handle of your app.
Hey @NiccosMedia, I tried your solution. It doesn't seem to work. My snippet is not getting rendered even if the app is installed.
There doesn't seem to be a property named "apps" on the shop object. It is not mentioned in the documentation as well: https://shopify.dev/api/liquid/objects/shop
Can you please share any documentation that you referred for the above solution.
If there is any other way to stop the snippet from rendering when the app is uninstalled, please do let me know, it would be of great help
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025