category
A store category.
Generated from the platform code - always matches what the theme engine allows.
A store category. Each store has its own category tree.
Available on: category page, home page, settings that point at it.
Properties
| Property | Type | Description |
|---|---|---|
category.id |
string | Category identifier. |
category.title |
string | Category name. |
category.handle |
string | The URL handle - /categories/<handle>/. |
category.url |
string | Address of the category page. |
category.childrenUrl |
string | JSON with the subcategories (/categories/<handle>/children.json) - load deeper menu levels on demand. |
category.icon |
file or null |
The category icon set in the admin (a file, image or SVG), null without one. Decorative - render it with an empty alt. An SVG (icon.vector) can be drawn as a CSS mask so it takes the text colour. |
category.image |
file or null |
The category image set in the admin (a file), null without one - a banner on the category page or a tile in a grid of categories. Its alt is the category name unless the file has its own. It is above the fold on the category page, so render it with loading: 'eager' and fetchpriority: 'high'. |
category.heading |
string | The H1 heading for the category page - set in the admin, the category name when left empty. Use it for the page heading and title everywhere else (menus, tiles, breadcrumbs). |
category.description |
string or null | Category description, sanitised HTML. |
category.additionalDescription |
string or null | A second description from the admin, sanitised HTML (empty without one) - usually shown below the products: a buying guide, FAQ or SEO text. |
category.seoTitle |
string or null | SEO title from the category. |
category.seoDescription |
string or null | Meta description from the category. |
category.depth |
number | 0 for a top-level category. |
category.parent |
category or null |
The parent category, null for a top-level one. |
category.ancestors |
list of category |
The path from the top-level category, for breadcrumbs. |
category.pathLabel |
string | The category path as text, for example Home › Beauty › Face. |
category.children |
list of category |
Subcategories with their offer counts. Only on a category page. |
category.siblings |
list of category |
Categories with the same parent, this one included. Only on a category page. |
category.filters |
hash | Listing filters of the page: active (chosen dictionary values, each with the URL that removes it), price_min and price_max (form values), price_url (the URL without the price), selected (feature slug to handles), sort (empty means the store default), clear_url, any (any filter is on) and page_url (with %d for the page number). |
category.products |
list of product |
The offers of the current listing page. |
category.productsCount |
number | Number of offers in the whole listing. |
Methods
| Method | Returns | Description |
|---|---|---|
category.facet(slug) |
list | Options of a dictionary filter among the listing's offers, by the address of the feature page - category.facet('brands'). A list of { title, handle, count }. |