[StoreFront API] How to get products under a collection, filtered by tags

alireza
Tourist
4 0 0

I am trying to get a list of products which usually you can get by visiting URLs like : 

.../collections/collection_handle/tag1+tag2

 

so collectionByHandle returns 

collectionByHandle(handle: String!): Collection

and a Collection contains products

products(
first: Int
after: String
last: Int
before: String
reverse: Boolean = false
sortKey: ProductCollectionSortKeys = COLLECTION_DEFAULT
): ProductConnection!

There I can't query and filter by tags. 

 

Can anyone please help?

0 Likes
alireza
Tourist
4 0 0

Another way is to query products and filter by tag

products(
first: Int
after: String
last: Int
before: String
reverse: Boolean = false
sortKey: ProductSortKeys = ID
query: String): ProductConnection!

returns a list of products with 

products(query:"tag:tag1"){
}

But again how to filter by collection now?

0 Likes

I am also interested in filtering/querying products belonging to a specific collection. I also started another topic about this, I somehow missed this one here.

0 Likes
PeanutButter
Shopify Partner
330 66 137

Interested in this too

Peanut Butter Collective | Shopify Experts
- Was my reply helpful? Please Like and Accept Solution.
- Want to customize and improve your store? Hire us.
- Feel free to contact me us hello@peanutbutter.es
0 Likes