ProductCategory

Interface

A visible product category of the storefront, as productCategories.getBySlug() returns it and as each node of the category tree carries it.

Text, slugs and paths are per locale. A read with a locale is served in that locale, or in the closest available one when the category has no translation there: the LocaleResolution fields say which.

Extends: LocaleResolution

Property

Type

Optional

Description

alternates

{ current: boolean; locale: string; path: string }[]

Yes

The category page's path in each locale it exists in, for hreflang links, sent when<br>the request has a locale. Empty on a fallback. Add x-default yourself.

canonicalPath

string | null

Yes

Canonical path of the category page, sent when the request has a locale. Equals<br>path, except on a fallback, where it points at the default-locale URL when one exists.

canonicalUrl

string | null

No

Canonical URL override, or null to use ProductCategory.path. A fallback<br>category with no override carries the absolute canonicalPath here when the site has a domain.

description

string | null

No

Description in the served locale, or null when unset.

id

string

No

Prefixed wire id (e.g. 'pcat_...'). Stable; safe to store and link.

image

string | null

No

Public image URL, or null when no image is set.

imageAlt

string | null

No

Alternative text of ProductCategory.image, suited to <img alt>, or null when none is set (fall back to name).

isFallback

boolean

Yes

true when the record is served in another locale because requestedLocale has no translation.<br>Absent when the request carried no locale. Never true with fallback: false.

keywords

string | null

No

Comma-separated SEO keywords (e.g. 'kitchen, tableware'), or null when none are set. Suited to <meta name="keywords">.

locale

string

Yes

BCP 47 locale code of the record actually served (e.g. 'en', 'fr').<br>Equals requestedLocale unless isFallback is true.

name

string

No

Category display name in the served locale (see LocaleResolution.locale).

noFollow

boolean

No

When true, the merchant asked search engines not to follow the links of this category: render <meta name="robots" content="nofollow">. Never null.

noIndex

boolean

No

When true, the merchant asked search engines not to index this category: render <meta name="robots" content="noindex">. Never null.

ogDescription

string | null

No

Open Graph description used when the category is shared on social networks, or null when unset (fall back to seoDescription).

ogImage

string | null

No

Public Open Graph image URL, or null when none is set (fall back to ProductCategory.image).

ogImageAlt

string | null

No

Alternative text of the Open Graph image, suited to og:image:alt, or null when none is set.

ogTitle

string | null

No

Open Graph title used when the category is shared on social networks, or null when unset (fall back to seoTitle, then name).

path

string | null

No

URL path of the category page in the requested locale (e.g. '/fr/categories/cuisine'),<br>built from the site's commerce URL settings. null while the product catalogue is off<br>for the site.

position

number

No

Sibling sort order, ascending.

requestedLocale

string

Yes

BCP 47 locale code the request asked for (e.g. 'de'), as sent in the<br>locale request option or the client's configured locale.<br>Absent when the request carried no locale.

seoDescription

string | null

No

SEO meta description, or null when unset.

seoTitle

string | null

No

SEO title override, or null when unset.

slug

string

No

Slug in the served locale: the translated slug when the category is translated, else<br>the source slug. Accepted as the category filter of products.list() with the same<br>locale.

structuredData

CommerceStructuredData

Yes

The category page's JSON-LD structured data. Sent by productCategories.getBySlug() only, never on tree nodes.

twitterCard

"summary" | "summary_large_image" | "app" | "player" | null

No

<meta name="twitter:card"> value used when the category is shared on social networks, or null when unset.


ProductCategoryTreeNode

Interface

A node of the storefront category tree: the fields of ProductCategory without structuredData, plus its visible sub-categories in children.

Extends: Omit<ProductCategory, "structuredData">

Property

Type

Optional

Description

alternates

{ current: boolean; locale: string; path: string }[]

Yes

The category page's path in each locale it exists in, for hreflang links, sent when<br>the request has a locale. Empty on a fallback. Add x-default yourself.

canonicalPath

string | null

Yes

Canonical path of the category page, sent when the request has a locale. Equals<br>path, except on a fallback, where it points at the default-locale URL when one exists.

canonicalUrl

string | null

No

Canonical URL override, or null to use ProductCategory.path. A fallback<br>category with no override carries the absolute canonicalPath here when the site has a domain.

children

ProductCategoryTreeNode[]

No

Child categories, ordered by position. Empty array for a leaf.

description

string | null

No

Description in the served locale, or null when unset.

id

string

No

Prefixed wire id (e.g. 'pcat_...'). Stable; safe to store and link.

image

string | null

No

Public image URL, or null when no image is set.

imageAlt

string | null

No

Alternative text of ProductCategory.image, suited to <img alt>, or null when none is set (fall back to name).

isFallback

boolean

Yes

true when the record is served in another locale because requestedLocale has no translation.<br>Absent when the request carried no locale. Never true with fallback: false.

keywords

string | null

No

Comma-separated SEO keywords (e.g. 'kitchen, tableware'), or null when none are set. Suited to <meta name="keywords">.

locale

string

Yes

BCP 47 locale code of the record actually served (e.g. 'en', 'fr').<br>Equals requestedLocale unless isFallback is true.

name

string

No

Category display name in the served locale (see LocaleResolution.locale).

noFollow

boolean

No

When true, the merchant asked search engines not to follow the links of this category: render <meta name="robots" content="nofollow">. Never null.

noIndex

boolean

No

When true, the merchant asked search engines not to index this category: render <meta name="robots" content="noindex">. Never null.

ogDescription

string | null

No

Open Graph description used when the category is shared on social networks, or null when unset (fall back to seoDescription).

ogImage

string | null

No

Public Open Graph image URL, or null when none is set (fall back to ProductCategory.image).

ogImageAlt

string | null

No

Alternative text of the Open Graph image, suited to og:image:alt, or null when none is set.

ogTitle

string | null

No

Open Graph title used when the category is shared on social networks, or null when unset (fall back to seoTitle, then name).

path

string | null

No

URL path of the category page in the requested locale (e.g. '/fr/categories/cuisine'),<br>built from the site's commerce URL settings. null while the product catalogue is off<br>for the site.

position

number

No

Sibling sort order, ascending.

requestedLocale

string

Yes

BCP 47 locale code the request asked for (e.g. 'de'), as sent in the<br>locale request option or the client's configured locale.<br>Absent when the request carried no locale.

seoDescription

string | null

No

SEO meta description, or null when unset.

seoTitle

string | null

No

SEO title override, or null when unset.

slug

string

No

Slug in the served locale: the translated slug when the category is translated, else<br>the source slug. Accepted as the category filter of products.list() with the same<br>locale.

twitterCard

"summary" | "summary_large_image" | "app" | "player" | null

No

<meta name="twitter:card"> value used when the category is shared on social networks, or null when unset.


ProductCategoryTreeResponse

Interface

Category tree response: the visible root nodes, each carrying its own children.

Property

Type

Optional

Description

data

ProductCategoryTreeNode[]

No

The visible root category nodes.