Hello,
This is a very annoying stuff that is probably extremely easy to fix on Shopify end. When rendering a snippet in app extensions, the rendered content will be wrapped by a HTML comment
This only happens in app extensions, and provide a very inconsistent experience with how it works in themes. One big issue with this is that we often render snippets, and then render other contents conditionally. One pattern that I use often in themes is this:
{% capture something %}{% render 'something' %}{% endcapture %}
{% if something != blank %}
// Do something
{% endif %}
But this never works in app theme xtensins, because for some reasons Shopify renders a comment, even when the output is empty.
To work around that, we therefore have to pollute our code with those kind of code:
{% capture something %}{% render 'something' %}{% endcapture %}
{% assign something = something | remove: <!-- BEGIN app snippet: SNIPPET-NAME --><!-- END app snippet --> %}
I’m all for having a consistent experience between theme and apps, and this is probably super easy to fix on Shopify end.
Thanks.