Classifications
How the shop organises its products: its classifications (Category, Brand, Material…) and each one's terms, for your site's menus and filters.
Reach them through storefront.taxonomies. A publishable or a secret key reads them.
List classifications
storefront.taxonomies.list(): Promise<Taxonomy[]>
The shop's classifications in the order the merchant set in the panel, without their terms. Read a classification's terms with its slug.
Returns
A list of Taxonomy, each:
| Field | Type | Description |
|---|---|---|
[].id | integer | |
[].slug | string | Names the classification in /api/v1/taxonomies/{taxonomy}/terms. |
[].name | string or null | |
[].isTree | boolean | Its terms have levels (a term under another). |
[].isMultiple | boolean | A product may have more than one of its terms. |
Errors
| Status | When |
|---|---|
401 | invalid_api_key: no active Storefront key of this shop, or invalid_customer_token: a bearer token not valid for this shop. |
402 | The shop is suspended (message only). |
403 | origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only). |
404 | Not found, or the shop's plan has no Integration API. |
429 | Rate limited. |
Example
const taxonomies = await storefront.taxonomies.list();
List a classification's terms
storefront.taxonomies.terms(taxonomy: string): Promise<TaxonomyTerm[]>
One classification's terms as a tree, each term's children under it. A classification without levels (isTree false) has no children. A term's id filters the product list as taxonomy.
Parameters
| Parameter | Type | |
|---|---|---|
taxonomy |
string |
The classification's slug, from list(). |
Returns
A list of TaxonomyTerm, each:
| Field | Type | Description |
|---|---|---|
[].id | integer | Filters the product list (taxonomy[]). |
[].slug | string | |
[].name | string or null | |
[].children | array of TaxonomyTerm |
Errors
| Status | When |
|---|---|
401 | invalid_api_key: no active Storefront key of this shop, or invalid_customer_token: a bearer token not valid for this shop. |
402 | The shop is suspended (message only). |
403 | origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only). |
404 | taxonomy_not_found, or the shop's plan has no Integration API. |
429 | Rate limited. |
Example
const brands = await storefront.taxonomies.terms('brand');
const page = await storefront.products.list({ taxonomy: [brands[0].id] });