【问题标题】:Field 'product' is missing required arguments: id字段“产品”缺少必需的参数:id
【发布时间】:2019-06-19 07:03:09
【问题描述】:

我在here 学习。

代码如下所示

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】:

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

    查询应该是这样的:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-16
      • 2019-03-25
      • 1970-01-01
      • 2021-01-17
      • 1970-01-01
      • 2021-11-05
      • 2019-11-19
      相关资源
      最近更新 更多