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

The ID of the category.

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

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

Category.privateMetafield ● String scalar miscellaneous

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

Tip: Use GraphQL aliases to fetch multiple keys.

Category.privateMetafield.key ● String! non-null scalar miscellaneous

Category.privateMetafields ● Metadata scalar miscellaneous

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

Category.privateMetafields.keys ● [String!] list scalar miscellaneous

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

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

Category.metafield ● String scalar miscellaneous

A single key from public metadata.

Tip: Use GraphQL aliases to fetch multiple keys.

Category.metafield.key ● String! non-null scalar miscellaneous

Category.metafields ● Metadata scalar miscellaneous

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

Category.metafields.keys ● [String!] list scalar miscellaneous

Category.seoTitle ● String scalar miscellaneous

SEO title of category.

Category.seoDescription ● String scalar miscellaneous

SEO description of category.

Category.name ● String! non-null scalar miscellaneous

Name of category

Category.description ● JSONString scalar miscellaneous

Description of the category.

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

Category.slug ● String! non-null scalar miscellaneous

Slug of the category.

Category.parent ● Category object products

Parent category.

Category.level ● Int! non-null scalar miscellaneous

Level of the category.

Category.descriptionJson ● JSONString deprecated scalar miscellaneous

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 miscellaneous

The date and time when the category was last updated.

Category.ancestors ● CategoryCountableConnection object products

List of ancestors of the category.

Category.ancestors.before ● String scalar miscellaneous

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

Category.ancestors.after ● String scalar miscellaneous

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

Category.ancestors.first ● Int scalar miscellaneous

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 miscellaneous

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 products

List of products in the category.

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

Filtering options for products.

Category.products.where ● ProductWhereInput input products

Filtering options for products.

Category.products.sortBy ● ProductOrder input products

Sort products.

Category.products.channel ● String scalar miscellaneous

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

Category.products.before ● String scalar miscellaneous

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

Category.products.after ● String scalar miscellaneous

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

Category.products.first ● Int scalar miscellaneous

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 miscellaneous

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 products

List of children of the category.

Category.children.before ● String scalar miscellaneous

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

Category.children.after ● String scalar miscellaneous

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

Category.children.first ● Int scalar miscellaneous

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 miscellaneous

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 miscellaneous

Background image of the category.

Category.backgroundImage.size ● Int scalar miscellaneous

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 miscellaneous

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

Category.translation ● CategoryTranslation object products

Returns translated category fields for the given language code.

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

A language code to return the translation for category.

Interfaces

Node interface miscellaneous

An object with an ID

ObjectWithMetadata interface miscellaneous

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