How can we create blocks theme:
What Are Blocks in Shopify?
Blocks are modular content elements that allow Shopify store owners to customize their store’s layout without modifying Liquid templates. Blocks reside within sections, enabling merchants to add, rearrange, and remove different content types effortlessly using the Shopify theme editor.
This feature empowers store owners to build dynamic, flexible pages while maintaining design consistency. Each section can contain multiple blocks, making it easier to create a visually appealing and functional store.
Benefits of Using Blocks
1. Enhanced Customization
Blocks enable merchants to incorporate various content elements, such as text, images, videos, and custom HTML, into their store’s design without requiring coding expertise.
2. Flexibility & Ease of Use
With Shopify’s intuitive drag-and-drop functionality, merchants can easily rearrange blocks to optimize their store’s visual appeal and user experience.
3. Consistency Across Pages
Using pre-defined block templates ensures a uniform look and feel across different sections of the store, enhancing branding and professional aesthetics.
4. Improved Performance
Instead of modifying entire sections, merchants can update specific blocks, reducing the need for extensive code changes and making theme updates smoother and more efficient.
How to Use Blocks in Shopify:
Follow these steps to create and implement blocks in Shopify:
Step 1: Open the Shopify Code Editor
- Navigate to Online Store > Themes in your Shopify admin panel.

- Click Actions > Edit Code to access the code editor.
Step 2: Create a New Section
To create a new section for blocks, follow these steps:
- In the Sections folder, click Add a new section.
- Section name test_blocks.liquid.
- Add the following code inside the section file:
<div class="dev_section">
<div class="container">
{% content_for 'blocks' %}
</div>
</div>
{% schema %}
{
"name": "Test Blocks",
"settings": [ ],
"blocks": [
{
"type": "@theme"
},
{
"type": "@app"
}
],
"presets": [
{
"name": "Test Blocks"
}
]
}
{% endschema %}
How {% content_for 'blocks' %} Works: When you include {% content_for 'blocks' %} in a section file, Shopify will:
1. Render blocks dynamically – This placeholder ensures that any blocks added via the theme editor will be displayed within the section.
2. Support multiple block types – As specified in the schema, different types of blocks (e.g., @theme, @app) can be used inside this section.
3. Enable merchant customization – Merchants can add, remove, and reorder blocks inside Shopify’s theme customizer without touching the code.
Example: Consider a scenario where you create a new section called test_blocks.liquid to hold dynamic blocks.
Step 3: Create a New Block
Now, create a block named Content.liquid to be used inside the section.
1. In the Blocks folder, click Add a new block.
2. Name the Block Content.liquid.
3. Add the following code inside the Block file:
<div class="content-section">
{% if block.settings.Heading != blank %}
<h2>{{ block.settings.Heading }}</h2>
{% endif %}
{% if block.settings.text != blank %}
<p>{{ block.settings.text }}</p>
{% endif %}
</div>
{% schema %}
{
"name": "Content",
"settings": [
{
"type": "text",
"id": "Heading",
"label": "Heading"
},
{
"type": "liquid",
"id": "text",
"label": "Text"
}
],
"presets": [
{
"name": "Content"
}
]
}
{% endschema %}
Conclusion
Shopify’s block functionality revolutionizes store customization by providing a user-friendly, drag-and-drop interface. Whether you are a beginner or an experienced developer, leveraging blocks helps create a dynamic store design, improves user experience, and streamlines updates. By following the steps above, you can easily integrate blocks into your Shopify store and enhance its overall functionality and aesthetics.