Skip to main content
Version: 3.x

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
updatedAt: DateTime!
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
}
Expand ▼

Fields

Category.id ● ID! non-null scalar

The ID of the category.

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
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
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
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
Category.metafields.keys ● [String!] list scalar

Category.seoTitle ● String scalar

SEO title of category.

Category.seoDescription ● String scalar

SEO description of category.

Category.name ● String! non-null scalar

Name of category

Category.description ● JSONString scalar

Description of the category.

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

Category.slug ● String! non-null scalar

Slug of the category.

Category.parent ● Category object

Parent category.

Category.level ● Int! non-null scalar

Level of the category.

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.updatedAt ● DateTime! non-null scalar

The date and time when the category was last updated.

Added in Saleor 3.17

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

Background image of the category.

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 ● 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


Was this page helpful?