How shopify/horizon works
Purpose and Runtime
Horizon is Shopify’s first-party Liquid storefront theme. Shopify servers render HTML from Liquid using store data; browser JavaScript progressively enhances the rendered page. The theme runs in evergreen browsers and depends on Shopify’s theme runtime, Storefront data objects, cart APIs, search, localization, and Theme Editor.
Entry Points and Page Composition
layout/theme.liquid is the primary document shell; layout/password.liquid serves password-gated storefronts. Shopify selects JSON/Liquid templates by route, such as templates/product.json, templates/collection.json, and templates/cart.json. Templates assemble configurable sections, whose schemas allow merchant configuration in the Theme Editor.
Section and Block Content Model
Sections are the main reusable page stages and own merchant-configurable layouts: sections/product-information.liquid, sections/main-collection.liquid, and sections/header.liquid. They compose theme blocks from blocks/, including product, media, text, navigation, and commerce blocks. sections/_blocks.liquid and sections/section.liquid are key composition/rendering boundaries for this block-oriented architecture.
Shared Liquid Presentation Layer
snippets/ provides shared rendering primitives used across sections and blocks, keeping server-side markup, styles, and Shopify-native formatting centralized. Product UI is concentrated in snippets/product-card.liquid, snippets/product-media-gallery-content.liquid, and snippets/variant-main-picker.liquid; cart drawer markup is centered on snippets/cart-drawer.liquid. Theme-wide HTML metadata, CSS, and script inclusion are composed through snippets/meta-tags.liquid, snippets/stylesheets.liquid, and snippets/scripts.liquid.
Client Enhancement and Component Boundary
Assets are browser modules/custom-element-style behavior layered onto Liquid markup rather than a client-rendered application. assets/component.js supplies a component foundation; assets/section-hydration.js connects behavior after server rendering; assets/section-renderer.js supports targeted asynchronous section replacement. Core interactive enhancements include dialogs/drawers, media, navigation, and accessibility focus management through assets/dialog.js, assets/theme-drawer.js, and assets/focus.js.
Commerce Flows
Product pages render Shopify product/variant state server-side, then synchronize selection, pricing, inventory, and add-to-cart interactions in the browser. The main client path is assets/variant-picker.js → assets/variant-resolution.js / assets/product-price.js → assets/product-form.js. Cart interactions use Shopify cart endpoints and update cart UI components, including assets/cart-drawer.js, assets/component-cart-items.js, and assets/component-cart-quantity-selector.js; sections/cart-drawer-section.liquid defines the server-rendered drawer target.
Discovery, Localization, and Configuration
Collection filtering, sorting, predictive search, and result rendering use Shopify-rendered content with incremental client behavior: assets/facets.js, assets/predictive-search.js, and sections/search-results.liquid. Localization is Shopify-managed and exposed through assets/localization.js plus translations in locales/en.default.json and peer locale files. config/settings_schema.json defines global merchant settings, while config/settings_data.json stores their configured values.
Main entry points: product-information.liquid Configurable sections · theme.liquid Document shells · component.js Component foundation · cart-drawer.js Cart commerce flow
Components 20
Shopify runtime
Server rendering, store data, and platform APIs.
- Storefront data & APIs · Provides Liquid objects, cart, search, and localization services.
Liquid composition
Route templates, configurable sections, blocks, and shared markup.
- Document shells · Primary and password-gated HTML shells.
layout/theme.liquid - Route templates · Shopify selects templates for product, collection, and cart routes.
templates/product.json - Configurable sections · Merchant-configurable page stages and layouts.
sections/product-information.liquid - Section/block renderer · Central boundary for rendering block-oriented sections.
sections/_blocks.liquid - Theme blocks · Reusable product, media, text, navigation, and commerce content.
blocks/product-card.liquid - Shared presentation · Centralizes shared markup, metadata, styles, scripts, and Shopify formatting.
snippets/scripts.liquid - Product UI markup · Cards, media gallery, and variant picker markup.
snippets/product-card.liquid - Cart drawer target · Server-rendered target for drawer updates.
sections/cart-drawer-section.liquid - Search results · Server-rendered search result content.
sections/search-results.liquid
Browser enhancement
Progressive JavaScript behaviors over rendered markup.
- Component foundation · Custom-element-style component behavior.
assets/component.js - Section hydration · Attaches behavior and supports targeted section replacement.
assets/section-hydration.js - Interaction primitives · Dialog, drawer, and focus-management behavior.
assets/dialog.js - Product commerce flow · Resolves variants and synchronizes price, inventory, and add-to-cart.
assets/variant-picker.js - Cart commerce flow · Updates cart items, quantities, and drawer UI through cart endpoints.
assets/cart-drawer.js - Discovery enhancements · Facets and predictive search enhance Shopify-rendered results.
assets/facets.js
Merchant configuration
Theme Editor settings and localization.
- Global settings schema · Defines merchant-configurable theme settings.
config/settings_schema.json - Configured settings · Stores merchant-selected setting values.
config/settings_data.json - Localization · Exposes Shopify-managed locale behavior and translations.
assets/localization.js - Locale translations
locales/en.default.json
Connections 24
- Storefront data & APIs → Document shells: renders with Liquid data
- Document shells → Route templates: hosts route content
- Document shells → Shared presentation: includes metadata and assets
- Route templates → Configurable sections: assembles
- Configurable sections → Section/block renderer: renders through
- Section/block renderer → Theme blocks: composes
- Configurable sections → Shared presentation: uses
- Theme blocks → Product UI markup: renders product markup
- Configurable sections → Cart drawer target: includes drawer section
- Shared presentation → Component foundation: loads browser modules
- Component foundation → Section hydration: supports
- Section hydration → Configurable sections: enhances rendered sections
- Component foundation → Interaction primitives: provides base behavior
- Product UI markup → Product commerce flow: behavior binds to markup
- Product commerce flow → Storefront data & APIs: variant and cart requests
- Cart drawer target → Cart commerce flow: behavior binds to drawer
- Cart commerce flow → Storefront data & APIs: cart endpoint requests
- Cart commerce flow → Section hydration: requests section replacement
- Search results → Discovery enhancements: enhanced by
- Discovery enhancements → Storefront data & APIs: search and filtering requests
- Global settings schema → Configurable sections: configures
- Configured settings → Global settings schema: supplies values for
- Locale translations → Localization: provides strings
- Localization → Storefront data & APIs: uses Shopify locale state