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
ancestors(
before: String
after: String
first: Int
last: Int
): CategoryCountableConnection
products(
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): Image
translation(languageCode: LanguageCodeEnum!): CategoryTranslation
}

Fields

id (ID!)

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.

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

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.

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

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.

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

metafields (Metadata)

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

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

seoTitle (String)

seoDescription (String)

name (String!)

description (JSONString)

Description of the category.

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

slug (String!)

parent (Category)

level (Int!)

descriptionJson (JSONString)

Description of the category.

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

ancestors (CategoryCountableConnection)

List of ancestors of the category.

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

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

Return the first n elements from the list.

Return the last n elements from the list.

products (ProductCountableConnection)

List of products in the category. Requires the following permissions to include the unpublished items: MANAGE_ORDERS, MANAGE_DISCOUNTS, MANAGE_PRODUCTS.

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

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

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

Return the first n elements from the list.

Return the last n elements from the list.

children (CategoryCountableConnection)

List of children of the category.

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

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

Return the first n elements from the list.

Return the last n elements from the list.

backgroundImage (Image)

Size of the image. If not provided, the original image will be returned.

The format of the image. When not provided, format of the original image will be used. Must be provided together with the size value, otherwise original image will be returned.

Added in Saleor 3.6.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

translation (CategoryTranslation)

Returns translated category fields for the given language code.

A language code to return the translation for category.

Interfaces

Node

An object with an ID

ObjectWithMetadata