template
The global template object identifies the template selected for the current
storefront render. It contains normalized template metadata, not the template
source or filesystem path.
Example
<body data-template="{{ template.name }}" {% if template.suffix %}data-template-suffix="{{ template.suffix }}"{% endif %}>For templates/product.featured.json, template.name is product,
template.suffix is featured, and template.directory is nil. For a
nested metaobject template such as templates/metaobject/article.alternate.json,
the name is article, the suffix is alternate, and the directory is
metaobject. Customer-account documents are system-owned and are not theme
templates.
Properties
| Property | Description |
|---|---|
template.directory | Template subdirectory such as metaobject, or nil for a top-level template. |
template.name | Base template name such as product, collection, or index. |
template.suffix | Alternate template suffix, or nil for the default template. |
Property list is generated from the storefront engine (TemplateDrop), so it always matches what your theme can use. Use {{ template | json }} only as a curated debug snapshot; it can omit lazy or otherwise public properties.