Skip to main content

Categories and navigation

Query the category tree, build navigation menus, display breadcrumbs and fetch category detail pages using Propeller's GraphQL API.

Fetching categories

Use the categories query to retrieve the category tree. Categories have a parent-child hierarchy that you can use to build nested navigation.

query GetCategories($language: String) {
categories {
items {
... on Category {
categoryId
name(language: $language) {
value
}
parent {
categoryId
name(language: $language) {
value
}
}
categoryPath {
categoryId
name(language: $language) {
value
}
}
}
}
itemsFound
page
pages
}
}

The response includes:

  • parent — the direct parent category (null for top-level categories)
  • categoryPath — the full hierarchy from root to the current category, useful for building breadcrumbs

Filtering categories

The categories query accepts a CategorySearchInput to narrow results:

FilterDescription
categoryIdFind categories by one or more IDs
parentCategoryIdFind child categories of a specific parent
nameFind categories by name (text search)
slugFind categories by URL slug
languageLanguage to use when searching by name or slug
hiddenFilter by visibility (Y or N)
sortFieldSort results by name, dateCreated or dateChanged
sortOrderSort direction: ASC (default) or DESC
page / offsetPagination controls

To fetch only top-level categories, filter by the root parent ID. The root category ID varies per Propeller installation:

query GetTopLevelCategories($language: String) {
categories(filter: { parentCategoryId: [1] }) {
items {
... on Category {
categoryId
name(language: $language) {
value
}
}
}
}
}

To fetch subcategories of a specific category:

query GetSubcategories($parentId: [Int!], $language: String) {
categories(filter: { parentCategoryId: $parentId }) {
items {
... on Category {
categoryId
name(language: $language) {
value
}
}
}
}
}

Category detail page

Fetch detailed information for a single category by slug:

query GetCategoryDetails($slug: String, $language: String) {
category(slug: $slug) {
categoryId
name {
language
value
}
description {
language
value
}
shortDescription {
language
value
}
slug(language: $language) {
value
}
parent {
categoryId
name(language: $language) {
value
}
}
categoryPath {
categoryId
name(language: $language) {
value
}
slug(language: $language) {
value
}
}
}
}

Use categoryPath to build a breadcrumb from the root category down to the current one.

Building a breadcrumb

The categoryPath field returns the full hierarchy as an ordered array. Each entry contains the category name, slug and ID, which you can map to your breadcrumb component.

This also works on the product query — products have a categoryPath field that returns the hierarchy of their assigned category.

Products within a category

To display products from a specific category, use the products query with a categoryId filter:

query GetCategoryProducts($categoryId: Int, $language: String) {
products(input: { categoryId: $categoryId }) {
items {
... on Product {
productId
names(language: $language) {
value
}
price {
gross
net
}
}
... on Cluster {
names(language: $language) {
value
}
defaultProduct {
productId
price {
gross
net
}
}
}
}
itemsFound
page
pages
}
}

This returns both products and clusters within the category. Combine with pagination, filters and sorting as described in Querying products.

Next steps