Introduction
Horizon showcases the latest Liquid Storefronts features, representing the future of Shopify theme development. These modern Liquid capabilities enable more flexible, maintainable, and powerful themes.Liquid Storefronts is the evolution of Shopify’s templating system, introducing features like theme blocks,
content_for, section groups, and more.Theme Blocks
Theme blocks are the cornerstone of Liquid Storefronts, enabling reusable, composable components.What are Theme Blocks?
Theme blocks are Liquid files in theblocks/ directory that:
- Can be added to any section that accepts
{ "type": "@theme" } - Are prefixed with an underscore (
_heading.liquid,_content.liquid) - Include their own schema and settings
- Are fully reusable across sections
Basic Theme Block Structure
blocks/_heading.liquid
Accepting Theme Blocks in Sections
sections/_blocks.liquid
Why type @theme?
Why type @theme?
The
@theme wildcard allows merchants to add any theme block from your blocks/ directory to the section. This provides maximum flexibility without hardcoding which blocks are allowed.Benefits:- Merchants can compose custom layouts
- No need to update section schema when adding new blocks
- Enables true composability
Nestable Theme Blocks
Horizon’s_content block demonstrates nested blocks:
blocks/_content.liquid
1
Content block added to section
Merchant adds
_content block to a section2
Nested blocks added
Merchant adds
_heading, _image, and button blocks inside the _content block3
Rendered with proper nesting
The
content_for 'blocks' captures nested children, and group snippet renders them with proper layoutcontent_for Tag
The{% content_for %} tag is a powerful Liquid Storefronts feature for rendering dynamic content.
Basic Usage
Advanced: content_for with Static Blocks
sections/carousel.liquid
Static blocks are defined in the section schema with
"static": true and always render in the same position.content_for with Context
Pass additional context to blocks:closest object:
blocks/_product-card.liquid
Section Groups
Section groups allow multiple sections to be rendered as a cohesive unit.Header Group
layout/theme.liquid
sections/header-group.json
Benefits
- Logical grouping of related sections
- Independent customization
- Better performance (grouped rendering)
- Cleaner template files
Use Cases
- Header (announcements + navigation)
- Footer (links + newsletter + social)
- Product page (details + recommendations)
Static vs Dynamic Blocks
Static Blocks
Static blocks always appear and cannot be removed by merchants:Dynamic Blocks
Dynamic blocks can be added, removed, and reordered:Documentation Tags
Horizon uses{%- doc -%} tags for inline documentation:
- Benefits
- Best Practices
- Self-documenting code
- Better developer experience
- Clear parameter expectations
- Usage examples embedded in code
Visible_if Conditions
Conditionally show/hide settings in the theme editor:visible_if creates dynamic, contextual settings that only appear when relevant, improving the merchant experience.Advanced Liquid Patterns
Liquid Tag
The{% liquid %} tag allows multi-line Liquid without repetitive delimiters:
Inline Stylesheets
Scope CSS to specific components:snippets/bento-grid.liquid
Benefits of Inline Stylesheets
Benefits of Inline Stylesheets
- Scoped styles: CSS only loads when the snippet is used
- Co-location: Styles live with markup
- Performance: Automatic critical CSS extraction
- Maintainability: Easier to update components
Translation Integration
Horizon usest: prefixes for all translatable strings:
locales/:
locales/en.default.json
Color Schemes
Horizon uses the color scheme system:Request Object Enhancements
Visual Preview Mode
Design Mode Detection
Performance Features
SVH Units
Horizon usessvh (small viewport height) for better mobile support:
Lazy Loading
Preloading Critical Assets
Best Practices
Use theme blocks for reusability
Use theme blocks for reusability
Create small, focused theme blocks that do one thing well. Compose complex layouts by combining multiple blocks.
Leverage content_for for flexibility
Leverage content_for for flexibility
Use
content_for 'blocks' to capture dynamic content and content_for 'block' for static blocks.Use visible_if for conditional settings
Use visible_if for conditional settings
Hide irrelevant settings to create a better merchant experience.
Embrace the {% liquid %} tag
Embrace the {% liquid %} tag
Use
{% liquid %} for complex logic to improve readability.Scope CSS with {% stylesheet %}
Scope CSS with {% stylesheet %}
Keep CSS co-located with components using inline stylesheet tags.
Examples from Horizon
Complete Section Example
sections/_blocks.liquid
Migration from Legacy Patterns
- Before (Legacy)
- After (Liquid Storefronts)
Next Steps
Theme Blocks Deep Dive
Learn advanced theme blocks patterns
Theme Structure
Understand sections, blocks, and snippets
Development Guide
Start building with Liquid Storefronts
API Reference
Official Shopify documentation