How to filter products by facet values? #2354
-
Hello, I'm trying to filter all products by facet values using the Here is my query: query Products($take: Int!, $skip: Int!) {
products(options:{
take: $take,
skip: $skip
}) {
totalItems
items {
slug
featuredAsset {
source
}
facetValues {
name
}
name
variants {
price
}
}
}
} There doesn't seem to be a way using the I might be missing a thing or two here but any help will be greatly appreciated. 😄 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, Your observations are correct - the Although the Here's a live demo of a faceted search: https://stackblitz.com/edit/vendure-docs-faceted-search |
Beta Was this translation helpful? Give feedback.
Hi,
Your observations are correct - the
products
query does not include the ability to filter by facet value, only thesearch
query has that functionality out of the box.Although the
search
query does not include the facet value names, you can get access to them via thefacetValues
field on the search response type. Here's some docs that show this: https://beta-docs.vendure.io/guides/storefront/listing-products/#faceted-searchHere's a live demo of a faceted search: https://stackblitz.com/edit/vendure-docs-faceted-search