magento2: Suggestions is not working in GraphQL
Preconditions and environment
Magento version (2.4.6-p1 CE) Magento add the suggestions attribute in GraphQL for the product Type Query
But when we fetch the data, suggestions are not showing even if the requested query has results because I have checked Magento to add suggestions when the search result has zero $totalcount in results.
Steps to reproduce
I am using Altair GraphQL chrome extension. Query is
{
products(
search: "metro"
) {
page_info{
current_page
page_size
total_pages
},
suggestions {
search
}
items {
name
sku
calculated_sqm_price
}
}
}
When the query has result :
When Query has no result
Expected result
I want to give matching terms in suggestion as Magento frontend return
I have debugged when the total count is zero and then triggered this resolver Magento\CatalogGraphQl\Model\Resolver\Products\Query\Suggestions::execute
But the $suggestionItems are empty.
Actual result
The Actual result is suggestions are null
I have check
Additional information
No response
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 18 (4 by maintainers)
hello @engcom-Dash as clearly seen in your screenshot as well, those suggestions are null and you are saying the issue is not reproducible. let me reiterate my query regarding suggestions The suggestions remain empty in both cases, either we have a matching result referring to screenshot1 OR we have no result referring to screenshot2
Does “suggestions” mean in Graphqls product() query that to show related products name Please guide me in this regard
I have fixed it on my end, but I am waiting for Magento end to fix it permanently.
In the custom module “schema.graphqls” file overrides Magento product()
Resolver class :