根据文档,"option set"字段是只读的:
https://developer.bigcommerce.com/api/stores/v2/products更新产品
这是否意味着你不能通过API将选项集应用到产品上?
有谁知道如何将选项集应用到产品上吗?
您正在寻找产品的子资源,您可以通过将ID发布到option_sets子资源https://developer.bigcommerce.com/api/objects/v2/option_set来设置ID
"option_set"为只读,"option_set_id"为可写。也就是说,您必须检索所需选项集的id并设置它。
PUT /products/11
{
"name": "Plain T-Shirt",
"type": "physical",
"description": "This timeless fashion staple will never go out of style!",
"price": "29.99",
"categories": [18],
"availability": "available",
"weight": "0.5",
**"option_set_id":25**
}