I am using the following graphql to list all products in all collections, I am trying to modify this now to only list products in a single collection, I know the collection ID already but I cannot figure out where to put it in order to filter on the collection ID.
{
shop {
collections(first: 10) {
edges {
node {
id
description
products(first: 250) {
edges {
node {
id
description
variants(first: 10) {
edges {
node {
id
sku
price
selectedOptions {
name
value
}
}
}
}
}
}
}
}
cursor
}
pageInfo {
hasNextPage
}
}
}
}
2
Answers
Instead of grabbing all collections and then filtering, you can just grab a collection by its handle.
Just replace
frontpage
with whatever your handle you like.