Skip to main content

Category Object

Represents a single category of products. Categories allow to organize products in a tree-hierarchies which can be used for navigation in the storefront.

type Category implements Node, ObjectWithMetadata {
id: ID!
privateMetadata: [MetadataItem!]!
privateMetafield(
key: String!
): String
privateMetafields(
keys: [String!]
): Metadata
metadata: [MetadataItem!]!
metafield(
key: String!
): String
metafields(
keys: [String!]
): Metadata
seoTitle: String
seoDescription: String
name: String!
description: JSONString
slug: String!
parent: Category
level: Int!
descriptionJson: JSONString @deprecated
updatedAt: DateTime!
ancestors(
before: String
after: String
first: Int
last: Int
): CategoryCountableConnection
products(
filter: ProductFilterInput
where: ProductWhereInput
sortBy: ProductOrder
search: String
channel: String
before: String
after: String
first: Int
last: Int
): ProductCountableConnection
children(
before: String
after: String
first: Int
last: Int
): CategoryCountableConnection
backgroundImage(
size: Int
format: ThumbnailFormatEnum = ORIGINAL
): Image
translation(
languageCode: LanguageCodeEnum!
): CategoryTranslation
}

Fields​

id ● ID!​

The ID of the category.

privateMetadata ● [MetadataItem!]!​

List of private metadata items. Requires staff permissions to access.

privateMetafield ● String​

A single key from private metadata. Requires staff permissions to access.

Tip: Use GraphQL aliases to fetch multiple keys.

key ● String!​

privateMetafields ● Metadata​

Private metadata. Requires staff permissions to access. Use keys to control which fields you want to include. The default is to include everything.

keys ● [String!]​

metadata ● [MetadataItem!]!​

List of public metadata items. Can be accessed without permissions.

metafield ● String​

A single key from public metadata.

Tip: Use GraphQL aliases to fetch multiple keys.

key ● String!​

metafields ● Metadata​

Public metadata. Use keys to control which fields you want to include. The default is to include everything.

keys ● [String!]​

seoTitle ● String​

SEO title of category.

seoDescription ● String​

SEO description of category.

name ● String!​

Name of category

description ● JSONString​

Description of the category.

Rich text format. For reference see https://editorjs.io/

slug ● String!​

Slug of the category.

parent ● Category​

Parent category.

level ● Int!​

Level of the category.

updatedAt ● DateTime!​

The date and time when the category was last updated.

ancestors ● CategoryCountableConnection​

List of ancestors of the category.

before ● String​

Return the elements in the list that come before the specified cursor.

after ● String​

Return the elements in the list that come after the specified cursor.

first ● Int​

Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

last ● Int​

Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

products ● ProductCountableConnection​

List of products in the category.

Requires the following permissions to include the unpublished items: MANAGE_ORDERSMANAGE_DISCOUNTSMANAGE_PRODUCTS
filter ● ProductFilterInput​
DEPRECATED

Use where filter instead.

Filtering options for products.

where ● ProductWhereInput​

Where filtering options for products.

sortBy ● ProductOrder​

Sort products.

Search products.

channel ● String​

Slug of a channel for which the data should be returned.

before ● String​

Return the elements in the list that come before the specified cursor.

after ● String​

Return the elements in the list that come after the specified cursor.

first ● Int​

Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

last ● Int​

Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

children ● CategoryCountableConnection​

List of children of the category.

before ● String​

Return the elements in the list that come before the specified cursor.

after ● String​

Return the elements in the list that come after the specified cursor.

first ● Int​

Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

last ● Int​

Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

backgroundImage ● Image​

Background image of the category.

size ● Int​

Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).

format ● ThumbnailFormatEnum​

The format of the image. When not provided, format of the original image will be used.

translation ● CategoryTranslation​

Returns translated category fields for the given language code.

languageCode ● LanguageCodeEnum!​

A language code to return the translation for category.

Show deprecatedHide deprecated

descriptionJson ● JSONString​

DEPRECATED

Use the description field instead.

Description of the category.

Rich text format. For reference see https://editorjs.io/

Interfaces​

Node​

An object with an ID

ObjectWithMetadata​

Returned By​

category query

Member Of​

AssignedMultiCategoryReferenceAttribute object ● AssignedSingleCategoryReferenceAttribute object ● Category object ● CategoryCountableEdge object ● CategoryCreate object ● CategoryCreated object ● CategoryDelete object ● CategoryDeleted object ● CategoryTranslatableContent object ● CategoryTranslate object ● CategoryUpdate object ● CategoryUpdated object ● MenuItem object ● Product object ● ProductCreated object ● ProductDeleted object ● ProductMetadataUpdated object ● ProductUpdated object

Implemented By​

_Entity union