Skip to content

Get Category

About

The category query retrieves detailed information about a single category by its ID. Use this query to:

  • Display category detail pages with complete information
  • Show category images, descriptions, and SEO metadata
  • Retrieve display settings and configuration options
  • Build breadcrumb navigation
  • Get category hierarchy information
  • Access all translations for multi-language support
  • Display category children and sub-categories
  • Render category-specific layouts and content

This query returns comprehensive category data including logos, banners, all translations, display modes, and child category information.

Arguments

ArgumentTypeDescription
idID!Category ID. Supports two formats: numeric ID (e.g., 1) or IRI format (e.g., /api/shop/categories/1). Required.

Possible Returns

FieldTypeDescription
idID!Unique category API identifier.
_idInt!Numeric category ID.
positionIntDisplay position among siblings.
logoPathStringFile path to category logo.
logoUrlStringFull URL to category logo image.
bannerPathStringFile path to category banner.
bannerUrlStringFull URL to category banner image.
statusIntCategory status (0 = inactive, 1 = active).
displayModeStringDisplay mode: products_only, category_and_products, products_and_description.
_lftIntLeft value for nested set tree structure.
_rgtIntRight value for nested set tree structure.
additionalStringAdditional metadata (JSON format).
translationCategoryTranslation!Default locale translation.
translation.idID!Translation identifier.
translation._idInt!Numeric translation ID.
translation.categoryIdInt!Associated category ID.
translation.nameString!Category name in current language.
translation.slugString!URL slug for the category.
translation.urlPathString!Full URL path including hierarchy.
translation.descriptionStringCategory description text.
translation.metaTitleStringSEO meta title tag.
translation.metaDescriptionStringSEO meta description.
translation.metaKeywordsStringSEO keywords.
translation.localeIdIntLocale identifier.
translation.localeString!Language locale code (e.g., 'en', 'ar', 'fr').
translationsCategoryTranslationCollection!All available translations.
translations.edges[Edge!]!Translation edges with cursors.
translations.edges.nodeCategoryTranslation!Individual translation.
translations.edges.cursorString!Pagination cursor for this translation.
translations.pageInfoPageInfo!Pagination info for translations.
translations.pageInfo.hasNextPageBoolean!More translations available.
translations.pageInfo.hasPreviousPageBoolean!Previous translations available.
translations.pageInfo.startCursorStringFirst translation cursor.
translations.pageInfo.endCursorStringLast translation cursor.
translations.totalCountInt!Total translations for this category.
createdAtDateTime!Category creation timestamp.
updatedAtDateTime!Last update timestamp.
urlStringFull category URL.
childrenCategoryCollection!Child categories.
children.edges[Edge!]!Child category edges.
children.edges.nodeCategory!Individual child category.
children.pageInfoPageInfo!Pagination info for children.
children.totalCountInt!Total child categories.

Display Modes

ModeDescription
products_onlyShow only products, no category description.
category_and_productsShow category and products together.
products_and_descriptionShow products with category description.

Use Cases

1. Category Detail Page

Use the "Complete Details" example to display a full category page with all information.

2. SEO Optimization

Use the "With SEO Data" example to get all metadata for search engines.

3. Category Display Settings

Use the "Display Settings" example to configure how the category should be rendered.

4. Category Hierarchy

Use the "With All Children" example to show subcategories.

Best Practices

  1. Cache Category Data - Categories change infrequently, cache the response
  2. Include All Translations - Fetch all translations for multi-language support
  3. Use Correct ID Format - Use /api/shop/categories/{id} format when available
  4. Optimize Field Selection - Request only fields your UI needs
  5. Include SEO Data - Always fetch meta tags for optimization
  6. Check Status - Verify category is active before displaying

Released under the MIT License.