How Can I render a snippet this name is defined by a variable?

Shopify Partner
6 0 0

I want to render a snippet this name is defined by a variable.

 

 

{% assign template_name = 'page-' | append: page.template_suffix %}
{% render template_name %}

But it occurs error that show "Syntax error in tag 'render' - Template name must be a quoted string".

 

"include" tag can render a snippet this name is defined by a variable.

 

Why "render" tag can't do it?

 

0 Likes
Shopify Partner
1149 131 193

Unfortunately, render doesn't accept dynamic names, most probably by design and taking into consideration the performance impact. 

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes