shopify店面api如何在单个集合中列出产品
我正在使用下面的graphql列出所有集合中的所有产品,我正在尝试将其修改为仅列出单个集合中的产品,我已经知道集合ID,但我无法确定将其放置在何处以便在集合ID上进行筛选shopify店面api如何在单个集合中列出产品,shopify,graphql,shopify-app,Shopify,Graphql,Shopify App,我正在使用下面的graphql列出所有集合中的所有产品,我正在尝试将其修改为仅列出单个集合中的产品,我已经知道集合ID,但我无法确定将其放置在何处以便在集合ID上进行筛选 { shop { collections(first: 10) { edges { node { id description products(first: 250) { edges {
{
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
}
}
}
}
您不必抓取所有集合然后进行过滤,只需通过其句柄抓取集合即可
{
shop {
collectionByHandle(handle: "frontpage") {
id
description
products(first: 250) {
edges {
node {
id
description
variants(first: 10) {
edges {
node {
id
sku
price
selectedOptions {
name
value
}
}
}
}
}
cursor
}
pageInfo {
hasNextPage
}
}
}
}
}
只需将frontpage
替换为您喜欢的手柄即可。以下是另一个带有特定收藏id的答案
Here is another answer with particular collection id wise
{
shop {
.node(id: <YOUR COLLECTION ID>) {
.onCollection {
.products(first: 10) {
pageInfo {
hasNextPage
}
edges {
node {
id
description
variants(first: 10) {
edges {
node {
id
sku
price
selectedOptions {
name
value
}
}
}
}
}
}
}
}
}
}
}
{
商店{
.node(id:){
1.未收集{
.产品(第一:10){
页面信息{
下一页
}
边缘{
节点{
身份证件
描述
变体(第一个:10个){
边缘{
节点{
身份证件
sku
价格
选择选项{
名称
价值
}
}
}
}
}
}
}
}
}
}
}