Skip to content

Aggregation in custom collection graphql magento2

I am creating a custom graphql query to view list of product. I need to add aggregation to my custom product list. For that I created a schema.

type ViewAllProducts {
products: [ProductInterface]
aggregations (filter: AggregationsFilterInput): [Aggregation]
@doc(description: “A bucket that contains the attribute
code and label for each filterable option.”)
@resolver(clas”VendornameHomepageGraphQlModelResolverAggregations”)
}

Like vendor file magento/module-catalog-graph-ql/Model/Resolver/Aggregations.php, resolver created.

But the result return null.
$value[‘layer_type’] and $value[‘search_result’] returns null