Skip to main content

Category

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
ancestors(
before: String
after: String
first: Int
last: Int
): CategoryCountableConnection
products(
filter: ProductFilterInput
where: ProductWhereInput
sortBy: ProductOrder
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

Category.id ● ID! non-null scalar

Category.privateMetadata ● [MetadataItem!]! non-null object

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

Category.privateMetafield ● String scalar

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

Tip: Use GraphQL aliases to fetch multiple keys.

Added in Saleor 3.3
This API is currently in Feature Preview and can be subject to changes at later point.
Category.privateMetafield.key ● String! non-null scalar

Category.privateMetafields ● Metadata scalar

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

Added in Saleor 3.3
This API is currently in Feature Preview and can be subject to changes at later point.
Category.privateMetafields.keys ● [String!] list scalar

Category.metadata ● [MetadataItem!]! non-null object

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

Category.metafield ● String scalar

A single key from public metadata.

Tip: Use GraphQL aliases to fetch multiple keys.

Added in Saleor 3.3
This API is currently in Feature Preview and can be subject to changes at later point.
Category.metafield.key ● String! non-null scalar

Category.metafields ● Metadata scalar

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

Added in Saleor 3.3
This API is currently in Feature Preview and can be subject to changes at later point.
Category.metafields.keys ● [String!] list scalar

Category.seoTitle ● String scalar

Category.seoDescription ● String scalar

Category.name ● String! non-null scalar

Category.description ● JSONString scalar

Description of the category.

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

Category.slug ● String! non-null scalar

Category.parent ● Category object

Category.level ● Int! non-null scalar

Category.descriptionJson ● JSONString deprecated scalar

DEPRECATED

This field will be removed in Saleor 4.0. Use the description field instead.

Description of the category.

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

Category.ancestors ● CategoryCountableConnection object

List of ancestors of the category.

Category.ancestors.before ● String scalar

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

Category.ancestors.after ● String scalar

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

Category.ancestors.first ● Int scalar

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

Category.ancestors.last ● Int scalar

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

Category.products ● ProductCountableConnection object

List of products in the category.

Requires the following permissions to include the unpublished items: MANAGE_ORDERSMANAGE_DISCOUNTSMANAGE_PRODUCTS
Category.products.filter ● ProductFilterInput input

Filtering options for products.

Added in Saleor 3.10
Category.products.where ● ProductWhereInput input

Filtering options for products.

Added in Saleor 3.14
This API is currently in Feature Preview and can be subject to changes at later point.
Category.products.sortBy ● ProductOrder input

Sort products.

Added in Saleor 3.10
Category.products.channel ● String scalar

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

Category.products.before ● String scalar

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

Category.products.after ● String scalar

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

Category.products.first ● Int scalar

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

Category.products.last ● Int scalar

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

Category.children ● CategoryCountableConnection object

List of children of the category.

Category.children.before ● String scalar

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

Category.children.after ● String scalar

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

Category.children.first ● Int scalar

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

Category.children.last ● Int scalar

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

Category.backgroundImage ● Image object

Category.backgroundImage.size ● Int scalar

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

Category.backgroundImage.format ● ThumbnailFormatEnum enum

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

Added in Saleor 3.6

Category.translation ● CategoryTranslation object

Returns translated category fields for the given language code.

Category.translation.languageCode ● LanguageCodeEnum! non-null enum

A language code to return the translation for category.

Interfaces

Node interface

An object with an ID

ObjectWithMetadata interface

Returned by

category query

Member of

Category object ● CategoryCountableEdge object ● MenuItem object ● Product object

Implemented by

_Entity union


Was this page helpful?