Skip to content

render

Renders a snippet in its own scope.

The snippet sees global objects and the parameters you pass, not the caller’s variables. “with x as name” passes one value; “for list as item” renders once per item, with forloop. Errors in a snippet show a marker in the theme editor and are hidden from shoppers.

{% render 'snippet', key: value %} · {% render 'card' with product as item %} · {% render 'card' for products as item %}
Name Type Description
snippet (required) string File name in snippets/, without .liquid.
key: value any Variables the snippet receives.
snippets/badge.liquid
<span class="badge">{{ label }}</span>
Liquid
{% render 'badge', label: 'New' %}{% render 'badge' for product.tags as label %}
Output
<span class="badge">New</span><span class="badge">linen</span><span class="badge">new</span><span class="badge">summer</span>

Since theme platform 1.0.

Was this page helpful?