Query for retrieving Product filters

Hi,

I’m trying to form a query to retrieve filters from the Storefront API to use them in a NextJS custom front.

I have this now, but I’m not sure if I’m doing it correctly? In the GraphiQL app it says that filters is not an available field on the ProductConnection type, while in the API docs filters is a field on the Products field..

query getCollectionFilters($handle: String!) {
collection(handle: $handle) {
products(first: 100) {
filters {
id
label
type
values {
id
label
count
}
}
}
}
}

Can you please share the documentation where you’re seeing this?

Here it says if I’m not mistaken. If you explore the Schema on the Storefront API you see the field as well.

If I paste the query shown in step 3 from the docs in the GraphiQL app in admin I get a few errors like that ID is a required argument for Collection and that field filters cannot be queried from type ProductConnection.

So I’m a bit confused now how to query available filters from the store. I would preferable fetch some of the default filters along with metafields I would add later.

I’ve successfully made the request with no issues. Are you certain you’re using the Storefront API?

Never mind. I was using the admin api indeed. Sorry bout that! Still very new to this.

Thanks nevertheless!:folded_hands: