Removal of theme snippets

Solved
Highlighted
Shopify Partner
4 1 4

As far as I can tell from poking around, `{% include %}` is not supported within a `{% render %}`ed snippet, so if a Legacy Section Theme updates to using `{% render %}` for snippets prior to the full release of the new storefront, that will mean any apps that are relying on `{% include %}` within these snippets won't work - is that correct?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
10 2 18

Correct. Not ideal right now, but we think it'll be better in the long run.

1 Like
Highlighted
Shopify Partner
125 7 30

@ThibautCyou said...

 

While {% include %} is deprecated, it will not be removed from the platform, as we don't break backward compatibility in the Liquid/Theme API.

I came across this screenshot "in the wild" this morning. Am I misunderstanding or did this roll out as a breaking change for some stores? As an app developer with thousands of customers relying on "include", I'm extremely concerned about this. Is my concern unfounded? I don't yet have support requests about this but I don't know if I should be expecting them to start rolling in at any moment.

Screenshot 2019-11-06 13.37.55.png

0 Likes
Highlighted
Shopify Partner
39 1 12

For this to have happened, the developer will have had to have used a {% include %} tag from within a {% render %} tag.

In terms of backwards compatibility, this shouldn't occur unless the above is done.

Liam Merlyn | Shopify Developer
0 Likes
Highlighted
Shopify Staff
Shopify Staff
10 2 18

While the behavior of {% include %} remains unchanged, when a theme adopts {% render %}, it changes the behavior of snippets in a manner that can be breaking certain apps. We've communicated this in our changelog, and will hold off on using {% render %} in Debut and all theme store themes until Feb 17, 2020.

1 Like
Highlighted
Shopify Expert
2684 67 775

You can use the {% capture %} tag to capture the output of the {% render %} and use it in the parent template. In cases where you have multiple resulting values, we recommend either splitting your snippet into multiple snippets, or inlining the code.

Would you consider adding this directly to  the  {% render %} tag as a shortcut, like:

 

{% render 'snippet' to result with value as internal_variable %}

will call snippet snippet and capture its output to the variable result?

 

I guess this could be useful  (and then supercool if snippet to output JSON and tag will parse it to make result an object :).

Because I can imagine people doing something like 

{% capture result %}
  {% render 'snippet' %}
{% end capture %}

{% assign result =  result | split: ";" %}

{% if result[0] == "something" %}
 {{ result.[1] }}
{% else %}
 {{ result.[2] }} {% endif %}

 

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
I am away till Feb-15.
1 Like
Highlighted
Shopify Staff
Shopify Staff
10 2 18

@tim I like the to result idea. We'll consider it.

 

We considered JSON parsing but decided against it. You can read some historical context about it here.

 

Thanks for the feedback!

1 Like
Highlighted

Thank ThibautC

i had the same problem

0 Likes