字段“产品”缺少必需参数:id

问题描述 投票:0回答:1

我正在这里学习。

代码如下所示

product(first:3){
    edges {
      node {
        id
        handle
        variants(first:3) {
          edges {
            node {
              id
              displayName
            }
          }
        }
      }
    }
  }

会给我

"errors": [
    {
      "message": "Field 'product' is missing required arguments: id",
      "locations": [
        {
          "line": 2,
          "column": 1
        }
       ]
       ....
    }
]

知道为什么需要 id 吗?通常它应该返回 3 个第一个产品及其 3 个变体。还有另一条消息“字段'产品'不接受参数'第一'”??

graphql shopify
1个回答
0
投票

尝试使用 API 名称“产品”而不是“产品”。

查询应该是这样的:

products(first:3){
    edges {
      node {
        id
        handle
        variants(first:3) {
          edges {
            node {
              id
              displayName
            }
          }
        }
      }
    }
  }
© www.soinside.com 2019 - 2024. All rights reserved.