Shopify API - 使用 graphQL 通过集合 ID 获取批量产品

时间:2021-01-30 22:04:32

标签: graphql shopify bulk shopify-api

我需要通过集合 ID 使用 Shopify API 获取所有产品...

我试过了:

mutation {
  bulkOperationRunQuery(
    query:"""
    {
      products(query: "tag:women OR collection:172173852808") {
        edges{
      node{
        id
        tags
        
        images {
          edges {
            node {
              id
              originalSrc
            }
          }
        }
        variants(first:10) {
          edges{
            node{
              id
              price
              compareAtPrice
              image{
                originalSrc
              }
              inventoryQuantity
              selectedOptions{
                name
                value
              }
              sku
              title
              weight
              weightUnit  
            }
          }
        }
      }
    }
      }
    }
    """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}

结果 Shopify 给我的只是带有标签的产品:女性,并且没有来自集合 ID 172173852808 的产品

如何运行查询以从一个或多个特定连接获取产品?

1 个答案:

答案 0 :(得分:1)

如果该系列中的每个产品都有标签woman,只需更改查询以批量下载该系列及其产品。此外,在您进行批量查询之前,请验证它是否有效,但不是批量查询。这通常会暴露设置问题。