【问题标题】:Updating product description in Magento 2 via REST通过 REST 在 Magento 2 中更新产品描述
【发布时间】:2017-01-05 10:18:01
【问题描述】:

我正在通过 REST API 将产品数据导出到 Magento 2 商店。创建产品效果很好,但是当我更新现有产品时,descriptionshort_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' }
  ]
}

我错过了什么吗?

【问题讨论】:

  • 嗨@geon,你解决问题了吗?我有同样的问题。如果您找到解决方案,请回答您赢得的问题。干杯
  • @luigibertaco 是的,我做到了。检查我现在发布的答案。

标签: rest magento2


【解决方案1】:

事实证明,Magento 由于某种原因使用的商店 ID 不一致。在请求 URL 中显式设置商店修复它。

错误的网址:/index.php/rest/all/V1/products/

好网址:/index.php/rest/default/V1/products/

看到了吗? all 应该在全球范围内影响产品,但没有奏效。使用default 选择默认(在我的情况下,仅)存储来解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多