通过API设置Shopify库存会导致某些产品“未找到”

时间:2019-06-07 09:19:59

标签: shopify

我与Shopify商店集成在一起,并通过API https://help.shopify.com/en/api/guides/updating-inventory更新了产品的库存水平

这对于95%的产品都可以正常工作,但是当我发送设置请求时,有些产品最终以“未找到”结尾:

POST到https://myshop.myshopify.com/admin/inventory_levels/set.json

使用:

{
    "location_id": XXXX,
    "inventory_item_id": XXXX,
    "available": 120
}

但我最终得到:

{
  "errors":"Not Found"
}

我知道location_id是正确的,因为在所有产品中都使用了location_id,并且仅设置了一个位置。

获取产品的结果给了我:

{
  "product":{
    "id":XX,
    "title":"Gems",
    "body_html":"",
    "vendor":"London",
    "product_type":"",
    "created_at":"2019-05-23T19:54:50+01:00",
    "handle":"gems",
    "updated_at":"2019-05-29T10:37:27+01:00",
    "published_at":"2019-05-24T11:50:34+01:00",
    "template_suffix":null,
    "tags":"category:jewels",
    "published_scope":"web",
    "admin_graphql_api_id":"gid:\/\/shopify\/Product\/XX",
    "variants":[
      {
        "id":XXX,
        "product_id":XX,
        "title":"Nights",
        "price":"5.95",
        "sku":"X",
        "position":1,
        "inventory_policy":"deny",
        "compare_at_price":null,
        "fulfillment_service":"manual",
        "inventory_management":"shopify",
        "option1":"Nights",
        "option2":null,
        "option3":null,
        "created_at":"2019-05-24T11:23:17+01:00",
        "updated_at":"2019-05-29T10:37:19+01:00",
        "taxable":false,
        "barcode":"654674",
        "grams":0,
        "image_id":null,
        "weight":0.0,
        "weight_unit":"g",
        "inventory_item_id":XXXX,
        "inventory_quantity":0,
        "old_inventory_quantity":0,
        "requires_shipping":true,
        "admin_graphql_api_id":"gid:\/\/shopify\/ProductVariant\/XX"
      }
    ],
    "options":[
      {
        "id":XX,
        "product_id":X,
        "name":"Color",
        "position":1,
        "values":[
          "Nights"
        ]
      }
    ],
    "images":[

    ],
    "image":null
  }
}

返回的stock_item_id是即时通讯正在使用的内容,我看不到该产品不允许我更新其库存的任何其他原因。有什么想法吗?

0 个答案:

没有答案