categories
categories is a Magento 2 GraphQL query in the Catalog module. Return a list of categories that match the specified filter. It returns CategoryResult and is callable anonymously.
Last verified: against Magento 2.4.9.
Returns
Resolver class
Magento\CatalogGraphQl\Model\Resolver\CategoriesQuery
Cache
identity: Magento\CatalogGraphQl\Model\Resolver\Category\CategoriesIdentity
Arguments
Identifies which Category filter inputs to search for and return.
Specifies the maximum number of results to return at once. The default value is 20.
Specifies which page of results to return. The default value is 1.
Example request
Auto-generated from the SDL — paste-ready against your store's /graphql endpoint. Replace the host, store code, and any required values before running.
Headers
Query
query {
categories {
items {
children { ... }
}
page_info {
page_size
current_page
total_pages
}
total_count
}
}Variables
{}Related in CatalogGraphQl
Other fields shipped by the same module.
category
DeprecatedSearch for categories that match the criteria specified in the `search` and `filter` attributes.
Catalog · returns CategoryTree
categoryList
DeprecatedReturn an array of categories based on the specified filters.
Catalog · returns [CategoryTree]
products
Search for products that match the criteria specified in the `search` and `filter` attributes.
Catalog · returns Products
Every Magento dev tool, in one hosted workspace.
Free to sign up. Nothing to install. Drafts, audits, and projects saved across every tool.