【问题标题】:Shopify API uploading product error when more than one option is selected选择多个选项时,Shopify API 上传产品错误
【发布时间】:2016-04-04 19:01:33
【问题描述】:

我正在尝试将我们公司的软件集成到 Shopify。一切看起来都很好,除非我尝试将产品发送到具有多个选项的 Shopify(即“尺寸”与变体“S、M、L”和“颜色”与变体“红色、蓝色、绿色”)。

这是错误信息。

(如果我只有一个选项,它可以正常工作)。

这是一个示例 XML 文件:

{
  "product": {
    "id": 0,
    "handle": "AMIN",
    "sku": "AMIN",
    "body_html": "",
    "product_type": "BULK",
    "title": "AMIN",
    "vendor": null,
    "variants": [
      {
        "id": 0,
        "barcode": null,
        "grams": 0.0,
        "option1": "S",
        "option2": "YELLOW",
        "option3": null,
        "price": 12.0000,
        "inventory_quantity": 1,
        "product_id": 0,
        "sku": "AMIN-SY",
        "weight": 0.0,
        "weight_unit": null,
        "image_id": null,
        "taxable": true,
        "title": "S YELLOW",
        "requires_shipping": true,
        "compare_at_price": 12.0000,
        "position": 1
      },
      {
        "id": 0,
        "barcode": null,
        "grams": 0.0,
        "option1": "S",
        "option2": "RED",
        "option3": null,
        "price": 12.0000,
        "inventory_quantity": 1,
        "product_id": 0,
        "sku": "AMIN-SR",
        "weight": 0.0,
        "weight_unit": null,
        "image_id": null,
        "taxable": true,
        "title": "S RED",
        "requires_shipping": true,
        "compare_at_price": 12.0000,
        "position": 2
      },
      {
        "id": 0,
        "barcode": null,
        "grams": 0.0,
        "option1": "S",
        "option2": "BLUE",
        "option3": null,
        "price": 12.0000,
        "inventory_quantity": 1,
        "product_id": 0,
        "sku": "AMIN-SB",
        "weight": 0.0,
        "weight_unit": null,
        "image_id": null,
        "taxable": true,
        "title": "S BLUE",
        "requires_shipping": true,
        "compare_at_price": 12.0000,
        "position": 3
      },
      {
        "id": 0,
        "barcode": null,
        "grams": 0.0,
        "option1": "M",
        "option2": "YELLOW",
        "option3": null,
        "price": 12.0000,
        "inventory_quantity": 1,
        "product_id": 0,
        "sku": "AMIN-MY",
        "weight": 0.0,
        "weight_unit": null,
        "image_id": null,
        "taxable": true,
        "title": "M YELLOW",
        "requires_shipping": true,
        "compare_at_price": 12.0000,
        "position": 4
      },
      {
        "id": 0,
        "barcode": null,
        "grams": 0.0,
        "option1": "M",
        "option2": "RED",
        "option3": null,
        "price": 12.0000,
        "inventory_quantity": 2,
        "product_id": 0,
        "sku": "AMIN-MR",
        "weight": 0.0,
        "weight_unit": null,
        "image_id": null,
        "taxable": true,
        "title": "M RED",
        "requires_shipping": true,
        "compare_at_price": 12.0000,
        "position": 5
      },
      {
        "id": 0,
        "barcode": null,
        "grams": 0.0,
        "option1": "M",
        "option2": "BLUE",
        "option3": null,
        "price": 12.0000,
        "inventory_quantity": 1,
        "product_id": 0,
        "sku": "AMIN-MB",
        "weight": 0.0,
        "weight_unit": null,
        "image_id": null,
        "taxable": true,
        "title": "M BLUE",
        "requires_shipping": true,
        "compare_at_price": 12.0000,
        "position": 6
      },
      {
        "id": 0,
        "barcode": null,
        "grams": 0.0,
        "option1": "LARGE",
        "option2": "YELLOW",
        "option3": null,
        "price": 12.0000,
        "inventory_quantity": 1,
        "product_id": 0,
        "sku": "AMIN-LY",
        "weight": 0.0,
        "weight_unit": null,
        "image_id": null,
        "taxable": true,
        "title": "LARGE YELLOW",
        "requires_shipping": true,
        "compare_at_price": 12.0000,
        "position": 7
      },
      {
        "id": 0,
        "barcode": null,
        "grams": 0.0,
        "option1": "LARGE",
        "option2": "RED",
        "option3": null,
        "price": 12.0000,
        "inventory_quantity": 1,
        "product_id": 0,
        "sku": "AMIN-LR",
        "weight": 0.0,
        "weight_unit": null,
        "image_id": null,
        "taxable": true,
        "title": "LARGE RED",
        "requires_shipping": true,
        "compare_at_price": 12.0000,
        "position": 8
      },
      {
        "id": 0,
        "barcode": null,
        "grams": 0.0,
        "option1": "LARGE",
        "option2": "BLUE",
        "option3": null,
        "price": 12.0000,
        "inventory_quantity": 3,
        "product_id": 0,
        "sku": "AMIN-LB",
        "weight": 0.0,
        "weight_unit": null,
        "image_id": null,
        "taxable": true,
        "title": "LARGE BLUE",
        "requires_shipping": true,
        "compare_at_price": 12.0000,
        "position": 9
      }
    ],
    "options": null,
    "images": null,
    "tags": null
  }
}

【问题讨论】:

  • 您忘记将错误信息添加到您的帖子中。

标签: shopify


【解决方案1】:

当您提供变体时,您必须在产品对象中提及选项。

"options": null, 更改为

"options":[{"name":"Size","position":1},{"name":"Color","position":2}],

同时从variants中删除idproduct_idoption3和从product中删除id。 Shopify 将自动分配 ids

【讨论】:

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