Magento 2 How to get Breadcrumb Information about Categories in GraphQL

If you want to use breadcrumb information, we will teach you how to get breadcrumb information about categories in this blog. Use the breadcrumbs attribute to return information about the parent categories of the queried category.

The following query returns breadcrumb information about categories.

Request

saveCopyzoom_out_map
{ categoryList(filters: {name: {match: "Tops"}}) { id level name breadcrumbs { category_id category_name category_level category_url_key } } }

Response

saveCopyzoom_out_map
{ "data": { "categoryList": [ { "id": 12, "level": 3, "name": "Tops", "breadcrumbs": [ { "category_id": 11, "category_name": "Men", "category_level": 2, "category_url_key": "men" } ] }, { "id": 21, "level": 3, "name": "Tops", "breadcrumbs": [ { "category_id": 20, "category_name": "Women", "category_level": 2, "category_url_key": "women" } ] } ] } }

That's it!!

If you are looking for more GraphQL solutions then check out our another article which is List of GraphQL Queries and Mutations for Magento 2.

I hope this article helps you to find what you were looking for.

Bookmark it for your future reference. Do comment below if you have any other questions on that.

P.S. Do share this article with your team.




Recent Articles
Tags
Newsletter
Chrome Extension
Copyright © 2024 devhooks.in All rights reserved.
Ads OFF toggle_off
wifi_off