You can fetch Custom User-defined category attribute value in the category GraphQL easily.
Let’s say, You have created a category attribute called, category_seo
You can get the category attribute value in Magento GraphQL in the given way,
Run categories Query,
{
categories(
filters: {
ids: {in: ["5"]}
}
) {
items {
uid
name
category_seo
}
}
}
Just Pass the correct category_id in the filters. I have added category id value to 5 but you need to pass your correct category value.
In the response, you will get a category attribute value in GraphQL.
{
"data": {
"categories": {
"items": [
{
"uid": "MjQ=",
"name": "Gift Items",
"category_seo": "student gift items SEO"
}
]
}
}
}
You can use multiple custom category attributes in a query and if the attribute has a value, it will return the result in GraphQL.
