Product filter & sorting using Storefront API

Product filter & sorting using Storefront API

bhagya19
Tourist
11 0 8

We are building custom storefront using Shopify's Storefront API which consists of standard catalog which is mapped to collection. Based on the selected collection, the corresponding products are fetched. We would also like to build filter on top of these products. Basically, build a unique list of product types & vendors belonging to the selected collection. On selecting any of the filter value, fetch the products matching the selected filter(s) for the collection.

Using collectionByHandle query root we are able to obtain the products belonging to the collection.

  1. There is productTypes query root that returns the unique list of product types. But how do we scope it to the collection?
  2. The endpoint doesn't accept query input in its products connection. How do we get products for a collection, matching the filter?
  3. How can we get unique list of vendors belonging to the collection?

Is there any workaround to it?

Highly appreciate any kind of inputs. Thank you!

Reply 1 (1)

CharlesRyan
Tourist
3 0 1

What's stopping you from doing the type-based filtering and gathering of vendor names after fetching the products from a collection?