Fetch a category breadcrumb
Get the full ancestor chain from root to the current category for breadcrumb navigation.
Query
query GetBreadcrumb($categoryId: Int!) {
category(categoryId: $categoryId) {
categoryId
name { language value }
categoryPath {
categoryId
name { language value }
slug { language value }
}
}
}
Variables
{
"categoryId": 1798
}
Response
{
"data": {
"category": {
"categoryId": 1798,
"name": [{ "language": "NL", "value": "2-in-1 Laptops" }],
"categoryPath": [
{
"categoryId": 17,
"name": [{ "language": "NL", "value": "PDM" }],
"slug": [{ "language": "NL", "value": "pdm" }]
},
{
"categoryId": 1794,
"name": [{ "language": "NL", "value": "ICT and hardware" }],
"slug": [{ "language": "NL", "value": "ict-and-hardware" }]
},
{
"categoryId": 1795,
"name": [{ "language": "NL", "value": "Computers / laptops" }],
"slug": [{ "language": "NL", "value": "computers-laptops" }]
}
]
}
}
}
How it works
categoryPath returns ancestors from root to the immediate parent. It does not include the current category itself. Root categories return an empty array. You can pass hidden: N to categoryPath to exclude hidden ancestors from the breadcrumb.