section
The properties and settings of a section.
Properties
The ID of the section.
The ID for sections included through JSON templates are dynamically generated by Shopify.
The ID for static sections is the section file name without the
.liquid
extension. For example, aheader.liquid
section has an ID ofheader
.The 1-based index of the current section within its location.
Use this property to adjust section behavior based on its position within its location (template, section group) and on the page. The
index
starts at 1 within each location.An example use case is for programmatically setting
loading="lazy"
for images below the fold based on an index higher than, for example, 3. Note that this is now the default behavior for thefilter.
Only use this for non-display use cases like web performance. Because of various limitations, the
index
property returnsnil
in the following contexts:- When rendered as a static section
- While rendering in the online store editor
- When using the Section Rendering API
The 0-based index of the current section within its location.
This is the same as the
index
property except that the index starts at 0 instead of 1.The scope or context of the section (template, section group, or global).
Sections can have one of four different location types. For sections rendered within a template, the location will be
template
. For sections rendered within a section group, the location will be the section group type, e.g.,header
,footer
,custom.<type>
. Sections rendered statically will bestatic
. Finally, if you're still using, then the value will be
.
- settings
The settings of the section.
To learn about how to access settings, refer to Access settings.
{
"blocks": [],
"id": "template--14453298921537__cart-items",
"settings": {}
}