Shopify Sections and Blocks Explained: How They Work, With Code
A Shopify section is a Liquid file that renders one part of a page, and blocks are the smaller pieces merchants add and reorder inside it. This guide shows the for block in section.blocks loop, what block.shopify_attributes does, and how section, theme and app blocks differ.

Sections and blocks in short
Generated by Ecompanda AI
A section is a Liquid file that renders one full-width part of a Shopify page, and blocks are the pieces merchants arrange inside it. A section renders its own blocks with a for loop over section.blocks, and each block's outer element needs block.shopify_attributes so the theme editor can find it.
- Online Store 2.0 JSON templates list which sections a page shows and in what order
- Section blocks live in one section's schema and cannot nest
- Theme blocks are files in /blocks, render with content_for 'blocks' and can nest up to 8 levels
- App blocks need an @app entry in the schema, and a looping section must render them with render block
- One section uses section blocks or theme blocks, not both
A Shopify section is a Liquid file that renders one full-width part of a page, such as a slideshow or an FAQ. A block is a smaller piece inside a section, like a slide, a question or a column, that merchants add, remove and reorder in the theme editor. The section draws its blocks with a loop, {% for block in section.blocks %}, and picks the markup for each one by block.type.
Below we show that loop in a complete section, explain block.shopify_attributes, and compare the three kinds of block. Then we cover the JSON templates and limits around them. If Liquid tags like case are new to you, our Liquid guide is the better place to start.
Try Shopify free
Open a store, set up your first products and test the ideas in this guide as you read.
Start free trialAffiliate link. We may earn a commission at no cost to you.
Looping over blocks: for block in section.blocks
To render a section's own blocks, loop over section.blocks, branch on block.type, and put {{ block.shopify_attributes }} on each block's outer element. That's the whole pattern.
Here it is in a complete FAQ section. It follows Shopify's section schema reference. Try it in a development theme before you ship it.
<div class="faq">
{% for block in section.blocks %}
{% case block.type %}
{% when 'question' %}
<details {{ block.shopify_attributes }}>
<summary>{{ block.settings.title | escape }}</summary>
{{ block.settings.answer }}
</details>
{% when '@app' %}
{% render block %}
{% endcase %}
{% endfor %}
</div>
{% schema %}
{
"name": "FAQ list",
"blocks": [
{
"type": "question",
"name": "Question",
"settings": [
{ "type": "text", "id": "title", "label": "Question" },
{ "type": "richtext", "id": "answer", "label": "Answer" }
]
},
{ "type": "@app" }
],
"max_blocks": 12,
"presets": [
{
"name": "FAQ list",
"blocks": [{ "type": "question" }, { "type": "question" }]
}
]
}
{% endschema %}What each part does:
for block in section.blockswalks the blocks in the order the merchant arranged them. A section holds up to 50 blocks, andmax_blockslowers that cap.case block.typepicks the markup. The type is thetypeyou set in the schema. Never testblock.idagainst a fixed string, because Shopify generates IDs and says they can change.{{ block.shopify_attributes }}sits on the block's outermost element, here the<details>. Without it the theme editor can't tie that element to the block.when '@app'with{% render block %}lets app blocks show up in a section that loops over its own blocks. The{ "type": "@app" }entry in the schema is what allows merchants to add them.presetsputs the section in the editor's Add section list.
One small trick is in there too. The editor sidebar names each block after a setting with the id heading, then title, then text, and falls back to the block name. We used title, so each block shows its actual question instead of "Question".
What is block.shopify_attributes?
block.shopify_attributes prints the data attributes the theme editor uses to identify a block. Put it on the block's outer element so the editor can link that element to the block, for example when a merchant selects the block in the sidebar and the shopify:block:select event fires. Outside the theme editor it prints nothing, so shoppers never see it.
Shopify's block object reference and its page on integrating sections and blocks with the editor both say this. Sections get the attribute on their Shopify-made wrapper automatically. Section blocks don't, so you add it by hand.
Theme blocks (more on those below) are wrapped in a Shopify <div> by default. If you switch that wrapper off with "tag": null, add the attribute yourself to the single top element of the block file.
The same loop in Dawn
Shopify's Dawn theme uses the same loop and attribute, and its code is public on GitHub. In sections/multicolumn.liquid, line 59 opens {%- for block in section.blocks -%} and line 72 puts {{ block.shopify_attributes }} on each column's <li>.

Look at lines 51 to 58 as well. Dawn loops over the blocks once before rendering anything, only to work out the highest image aspect ratio. So you can loop as often as you need. Line 70 shows another habit worth copying: forloop.index gives each block a number for its HTML id.
If you're editing Dawn itself, our Dawn customisation guide covers the safer ways to do it.
How a page is built in Online Store 2.0
In a current theme, most page types use a JSON template, a data file that lists which sections a page shows and in what order. JSON templates arrived with Online Store 2.0, and they're why merchants can add, remove and reorder sections on most pages from the theme editor.
Four layers decide what a visitor sees:
- A layout (usually
layout/theme.liquid) is the frame around every page. - Section groups fill the parts of the frame that repeat, normally the header and footer.
- A template fills the middle. In an Online Store 2.0 theme it's a JSON file that lists sections.
- Sections hold the markup and settings, and blocks are the pieces merchants arrange inside them.

Upgrading to Online Store 2.0 isn't mandatory, and older "vintage" themes keep working. Our Online Store 2.0 guide covers what else changed.
JSON templates
A JSON template has two required keys. sections is an object whose keys are section IDs, and order lists those IDs in render order. Each section entry names its type (the section's filename without .liquid), its settings, its blocks and a block_order.
{
"sections": {
"main": {
"type": "main-product",
"settings": {}
},
"faq": {
"type": "faq-list",
"blocks": {
"q1": {
"type": "question",
"settings": { "title": "Do you ship worldwide?", "answer": "<p>Answer goes here.</p>" }
},
"q2": {
"type": "question",
"settings": { "title": "How do I care for it?", "answer": "<p>Answer goes here.</p>" }
}
},
"block_order": ["q1", "q2"]
}
},
"order": ["main", "faq"]
}Shopify renders the sections in order with no markup between them. A section marked "disabled": true is skipped on the page but stays editable. The template can also name a different layout, or false for none, though those pages can't be customised in the editor.
Section groups
A section group is the same idea for the repeating parts of a layout. It's a JSON file in sections/ with a type (header, footer, aside or custom.<name>), a name, sections and order. You place it in the layout with one tag:
{% sections 'header-group' %}Shopify suggests using groups only for the header and footer in most themes. Inside a group, merchants can add and reorder sections, which is how an announcement bar ends up above the header with no code change.
Static and dynamic sections
A dynamic section is listed in a JSON template or section group, so merchants control it. A static section is rendered straight from Liquid with {% section 'featured-product' %}.
Merchants can't move or remove a static section. There's also only one instance of it, so changing its settings in one place changes it everywhere it appears. Shopify's advice is to avoid static sections and move old ones into section groups. We'd follow it for anything a merchant might one day want to move.
Section schema: the keys that matter
Every section file needs exactly one {% schema %} tag holding valid JSON, and it can't sit inside another Liquid tag. Two schema tags, or a nested one, is a syntax error. These are the keys you'll use most:
| Key | What it does |
|---|---|
| name | The title in the editor. Capped at 25 characters. |
| tag | The wrapper element: article, aside, div, footer, header or section. Default is a div. |
| class | Extra classes on the wrapper, after shopify-section. |
| limit | 1 or 2, to cap how often the section can be added. |
| settings | Section-wide options. Each setting id must be unique in the section. |
| blocks | The blocks the section accepts. |
| max_blocks | Lowers the default cap of 50 blocks. |
| presets | Starting points. Without one, merchants can't add the section in the editor. |
| default | Starting settings for a section you render statically. |
| enabled_on / disabled_on | Limit the section to, or keep it off, certain templates and groups. Use one, not both. |
| locales | Translations that travel with the section. |
Section blocks, theme blocks and app blocks
Shopify has three kinds of block. Section blocks are defined inside one section's schema, like the FAQ above. Theme blocks are their own files in /blocks, reusable across sections and able to nest. App blocks come from apps installed on the shop.
| Section blocks | Theme blocks | App blocks | |
|---|---|---|---|
| Defined in | The section's schema | Their own file in /blocks | An app's theme app extension |
| Reusable | Only in that section | Across sections and blocks | Wherever a schema accepts @app |
| Can nest | No | Yes, up to 8 levels | n/a |
| Rendered with | for block in section.blocks | content_for 'blocks' | content_for 'blocks', or render block in a loop |
| Best for | Simple lists: slides, FAQs | Flexible layouts | Content an app provides |
One rule catches people out. A section either defines its own blocks or accepts theme blocks, not both, and Shopify's blocks overview says so. To move an older section to theme blocks, you convert its blocks rather than add to them.
Theme blocks and content_for 'blocks'
A theme block is a file in /blocks with markup and a schema. It reads its own settings through the block object. Here's a card block, then a section that holds cards:
<h3>{{ block.settings.heading }}</h3>
{{ block.settings.text }}
{% schema %}
{
"name": "Card",
"tag": "article",
"class": "feature-card",
"settings": [
{ "type": "text", "id": "heading", "label": "Heading", "default": "Free returns" },
{ "type": "richtext", "id": "text", "label": "Text" }
],
"presets": [{ "name": "Card" }]
}
{% endschema %}<div class="feature-columns" style="--columns: {{ section.settings.columns }}">
{% content_for 'blocks' %}
</div>
{% schema %}
{
"name": "Feature columns",
"settings": [
{ "type": "range", "id": "columns", "label": "Columns", "min": 1, "max": 4, "step": 1, "default": 3 }
],
"blocks": [{ "type": "_card" }, { "type": "@app" }],
"presets": [
{ "name": "Feature columns", "blocks": [{ "type": "_card" }, { "type": "_card" }, { "type": "_card" }] }
]
}
{% endschema %}Notice there's no for loop. {% content_for 'blocks' %} renders every block the merchant added, app blocks included, in their saved order. Three details make it work:
- Presets make a theme block selectable. A theme block shows in the block picker only if it defines
presets. A preset can include child blocks, which is how you ship ready-made nested layouts. @themeand named types set what's allowed.{ "type": "@theme" }accepts every theme block. Naming one ("type": "_card") accepts only that block.- An underscore makes a block private. A file like
_card.liquidis left out of the picker for@themesections and appears only where a schema names it. Good for pieces like slides that only make sense in one place.
To nest, give a theme block its own blocks array and render its children with {% content_for 'blocks' %}. Shopify allows 8 levels below the section. We'd stop at two or three. Every extra level is one more thing a merchant can rearrange into a broken-looking page.
Theme blocks aren't snippets. They show settings in the editor, but a block rendered by content_for 'blocks' can't receive variables from the code around it. Use snippets for repeated markup and blocks for things merchants should edit.
Static blocks
A static block is a theme block you render in a fixed spot, with an id you choose:
{% content_for 'blocks' %}
{%- if section.blocks.size > 1 -%}
{% content_for 'block', type: '_slideshow-controls', id: 'controls' %}
{%- endif -%}Merchants can hide and edit a static block, but not drag, remove or duplicate it. Because it's plain Liquid, you can wrap it in an if or a loop and pass it parameters. Static blocks also don't count toward the section's block limit.

In saved JSON, static blocks carry "static": true and stay out of block_order, because nobody can reorder them.
Theme block settings can also pull live data, such as the product on the page or a metafield. Inside a nested block you often can't tell where that data came from, so Shopify provides a closest path that finds the nearest resource of a given type.
App blocks
App blocks let an app add content to a theme without editing theme code. Apps build them with theme app extensions. A section or theme block accepts them through one schema entry:
"blocks": [{ "type": "@app" }]The rules from Shopify's app blocks page:
@appblocks can't take alimit. Adding one is an error.- They don't work in statically rendered sections.
content_for 'blocks'renders them for you. A section that loops over its own blocks needs thewhen '@app'branch from our FAQ example.- When a merchant adds an app as its own section, Shopify wraps it in an
apps.liquidsection. You can supply your own, but it must accept@appblocks and have a preset. Without one, Shopify looks for_blocks.liquid.
Shopify's advice is to offer app blocks where an app can help a purchase, such as the product page. Skip them in layouts that would break when an unexpected block turns up.
Theme blocks so far, and the block and partial tags
| Date | What changed | Source |
|---|---|---|
| 31 January 2024 | Theme blocks announced in developer preview, with nesting up to 8 levels | Shopify Partners blog |
| 21 May 2025 | Recommended blocks in the picker, block previews, parameters for static blocks | Shopify changelog |
| 21 July 2026 | Liquid July '26 developer preview adds the block and partial tags | Shopify changelog |
The July 2026 preview lets a Liquid template compose a page directly with {% block %} instead of listing sections in JSON. {% partial %} marks a region JavaScript can refresh without a full reload.
Shopify says existing themes keep working with sections, theme settings and JSON templates. It's still a preview, so don't rebuild a live theme around it yet.

We couldn't find a dated note saying theme blocks left preview, but Shopify's current docs treat them as a normal feature.
Limits worth knowing
| Limit | Value |
|---|---|
| JSON templates per theme | 1,000 |
| Sections per JSON template or section group | 25 |
| Blocks per section | 50 |
| Blocks per JSON template or section group | 1,250 |
| Section groups per theme | 20 |
| Theme block files in /blocks | 300 |
| Section or block schema name | 25 characters |
| JSON template or section group file | 512 KB |
| Other Liquid files | 256 KB |

Going over a limit gives an error in the editor or when the theme is saved or uploaded. Every .liquid file in /blocks counts toward the 300, including unused and AI-generated blocks. The full list is on Shopify's theme limits page.
Mistakes we'd avoid
- JavaScript that only runs on page load. The editor re-renders sections in place. Listen for
shopify:section:loadandshopify:section:unload, and checkShopify.designModein JavaScript orrequest.design_modein Liquid to detect the editor. - Over-granular blocks. Author, date and comment count belong in one block, not three.
Frequently asked questions
What is the difference between a section and a block?
A section is a Liquid file that forms a full-width part of a page, added to a template or section group. A block is a smaller piece inside a section, such as a heading, a button or a slide. Merchants arrange sections on the page and blocks inside a section.
Why can't the theme editor identify my block?
Usually the block's outer element is missing {{ block.shopify_attributes }}. The editor looks for that data attribute to identify blocks, so without it the editor can't tell which element belongs to the block. Add it to the top element inside your for loop, or to the single top element of a theme block that uses "tag": null.
Can I use section blocks and theme blocks in the same section?
No. Shopify says a section can define blocks locally or accept theme blocks, but not both at once. A theme can mix the two across different sections.
Why doesn't my section appear in the Add section list?
Most often the schema has no presets, or enabled_on or disabled_on excludes the current template. Also check the schema is valid JSON with a single schema tag.
Do app blocks work in every section?
No. The section or theme block must include { "type": "@app" } in its schema, and statically rendered sections can't take app blocks at all. Merchants can still add an app as its own section, wrapped by apps.liquid.
What are Online Store 2.0 sections?
They're the same sections. Online Store 2.0 brought JSON templates, which let merchants add, remove and reorder sections on most pages from the theme editor. It also brought app blocks and dynamic sources.
Will the new block and partial tags replace sections?
Shopify hasn't said so. The July 2026 developer preview adds the tags alongside the current model and says sections, theme settings and JSON templates keep working.
How do I know if my theme uses theme blocks?
Open the theme's code editor and look for a blocks folder in the sidebar. If it's there, the theme supports theme blocks, though some sections may still use section blocks.
Where we can help
We build and maintain Shopify themes, including custom sections and theme blocks merchants can edit without a developer. If you want a section built properly or an old theme moved to blocks, get in touch. For the bigger picture, read our overview of custom theme development.
Sources
The Shopify pages this guide rests on. Check the current version before you rely on a detail.
- Sections, shopify.dev
- Section schema, shopify.dev
- Section blocks, shopify.dev
- The block object, shopify.dev
- Integrate sections and blocks with the theme editor, shopify.dev
- Blocks overview, shopify.dev
- Theme block schema, shopify.dev
- Theme block targeting, shopify.dev
- Static blocks, shopify.dev
- App blocks for themes, shopify.dev
- JSON templates, shopify.dev
- Section groups, shopify.dev
- Online Store 2.0, shopify.dev
- Theme limits, shopify.dev
- Dawn multicolumn section, GitHub
Shopify agency
We build, fix and grow Shopify stores.
Tell us what you are working on. We reply by email within one business day.
Work with Ecompanda


