如何使用ShopifyAPI向产品变量添加项目成本?

2024-10-01 09:33:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用官方的shopifigapi pythonsdk以编程方式向Shopify商店添加几十种产品,但我不知道如何指定每个变体的成本。你知道吗

这是我迄今为止尝试过的:

variant = shopify.Variant()
variant.price = price
variant.option1 = size
variant.inventory_quantity = qty
variant.inventory_management = "shopify"
variant.fullfilment_service = "manual"
variant.requires_shipping = True
variant.sku = sku
variant.taxable = False
variant.inventory_policy = 'deny'
variant.cost = cost
new_product.variants.append(variant)

当然,variant.cost不起作用。我该怎么做?还是还不支持?你知道吗

我使用的是ShopifAPI版本5.1.0,API版本是2019-07。你知道吗


Tags: 版本官方产品编程方式price商店inventory
1条回答
网友
1楼 · 发布于 2024-10-01 09:33:13

不能使用variant update api调用更新单位成本,需要调用inventoryItem api来更新单位成本。你知道吗

**Update a unit cost**

PUT /admin/api/#{api_version}/inventory_items/#{inventory_item_id}.json
{
  "inventory_item": {
    "id": 808950810,
    "cost": "25.00"
  }
}

请参考此链接https://help.shopify.com/en/api/reference/inventory/inventoryitem#update-2019-07

相关问题 更多 >