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

alireza
Shopify Partner
5 0 3

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?

Replies 4 (4)

alireza
Shopify Partner
5 0 3

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?

bjoernwolf
Shopify Expert
4 0 0

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.

PeanutButter
Shopify Partner
385 67 181

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

Alireza_jahan
Visitor
2 0 1

Any updates on this after 2 years?