-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Description
When using the GraphQL products query in Virto Commerce to search for products with filters, an unexpected and invalid behavior occurs with term facets aggregation.
By default, the query automatically applies the filter: is:product
This correctly limits the results to main products only (excluding variations).
However, this same filter is also being applied to the term facets aggregation, which causes the facets to include only the main products and ignore variations.
As a result, attributes like Size, Color, etc., show incomplete or incorrect filtering options.
Example Scenario
Product Data
- Main Product: Size S
- Variations: Sizes M, L, XL
Current Behavior
- Returned products: ✅ Only the main products
- Returned facets: ❌ Only include Size S (missing M, L, XL)
Expected Behavior
- Returned products: ✅ Only main products (as per
is:product) - Returned facets: ✅ Include attributes aggregated across both main products and their variations.
Impact
This leads to invalid filtering data on the storefront.
For example, the size filter will only show “S” even though the product has available sizes “M, L, XL” as variations.
It results in a poor and misleading shopping experience for customers.
Suggested Solution
Introduce a boolean argument in the products GraphQL query to control how facet aggregation is computed.
Current Workaround
The only available workaround is to run two separate GraphQL queries:
- Query 1: With
is:(product,variation)to get correct term_facets - Query 2: With
is:productto get main product listings