通过 REST 在 Magento 2 中更新产品描述
Updating product description in Magento 2 via REST
我正在通过 REST API 将产品数据导出到 Magento 2 商店。创建产品效果很好,但是当我更新现有产品时,description
和 short_description
没有更新。
数据:
{
sku: 'LEDSL302',
price: 7,
name: 'LEDguardian®',
attribute_set_id: 4,
type_id: 'simple',
custom_attributes: [
{ attribute_code: 'description', value: 'foo' },
{ attribute_code: 'short_description', value: 'bar' }
]
}
我是不是漏掉了什么?
原来 Magento 出于某种原因在它使用的商店 ID 上不一致。在请求中明确设置商店 URL 修复了它。
差url:/index.php/rest/all/V1/products/
好url:/index.php/rest/default/V1/products/
看到了吗? all
应该在全球范围内影响产品,但没有奏效。选择带有 default
的默认(在我的例子中,仅)存储来解决问题。
我正在通过 REST API 将产品数据导出到 Magento 2 商店。创建产品效果很好,但是当我更新现有产品时,description
和 short_description
没有更新。
数据:
{
sku: 'LEDSL302',
price: 7,
name: 'LEDguardian®',
attribute_set_id: 4,
type_id: 'simple',
custom_attributes: [
{ attribute_code: 'description', value: 'foo' },
{ attribute_code: 'short_description', value: 'bar' }
]
}
我是不是漏掉了什么?
原来 Magento 出于某种原因在它使用的商店 ID 上不一致。在请求中明确设置商店 URL 修复了它。
差url:/index.php/rest/all/V1/products/
好url:/index.php/rest/default/V1/products/
看到了吗? all
应该在全球范围内影响产品,但没有奏效。选择带有 default
的默认(在我的例子中,仅)存储来解决问题。