Sections are used to host reusable modules of content that merchants can customize.
Section files are hosted in the
sections directory of the theme.
Liquid in sections
Sections also support the following Liquid tags, which are unique to sections:
Aside from global objects, variables created outside of sections aren't accessible within sections.
The section and block objects, as well as variables created within sections, aren't available outside of their respective section. The only exception is when you reference section and block objects within a snippet that's rendered inside the associated section.
Render a section
You can render sections in one of the following ways:
- Include the section in a JSON template
- Statically render the section with the
- Use the Section Rendering API
Statically render a section
You can statically render a section using the Liquid section tag.
For example, if you have a
/sections/header.liquid file that contains your theme's header content, then you might want to include that section in
theme.liquid so that the header is rendered on all pages that use that layout: