content_for
Last updated View as Markdown
Use it in a section or a theme block to render theme blocks.
Blocks
liquid
{% content_for 'blocks' %}1
The blocks that sellers added to the section or the block are rendered in the order of order. Disabled blocks are not rendered.
Static block
liquid
{% content_for 'block', type: 'price', id: 'price' %}1
One static block is rendered. Sellers can edit its settings in the theme editor, but they cannot move or remove it.
Arguments
type: The theme block type, the file name in theblocksdirectory without the.liquidextension. Required.id: The block ID. It must be unique inside the section or the block where you use the tag. Required.
You can pass more arguments. They are available as variables inside the block file. Use an argument whose name starts with closest. to set the matching closest object, for example closest.product: featured_product.
When type or id is missing, nothing is rendered.
Example
liquid
<div class="product-card">
{% content_for 'block', type: '_product-image', id: 'image', closest.product: product %}
{% content_for 'blocks' %}
</div>1
2
3
4
2
3
4