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.
Syntax
Section titled “Syntax”{% render 'snippet', key: value %} · {% render 'card' with product as item %} · {% render 'card' for products as item %}Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
snippet (required) |
string | File name in snippets/, without .liquid. |
key: value |
any | Variables the snippet receives. |
Example
Section titled “Example”<span class="badge">{{ label }}</span>{% render 'badge', label: 'New' %}{% render 'badge' for product.tags as label %}<span class="badge">New</span><span class="badge">linen</span><span class="badge">new</span><span class="badge">summer</span>Related
Section titled “Related”Compatibility
Section titled “Compatibility”Since theme platform 1.0.
Was this page helpful?

