尝试在Shopify中添加变体时出错

时间:2017-02-08 13:42:27

标签: shopify variant

我正在尝试为现有的产品ID添加变体。 下面是我做过的JSON请求。但是我收到了错误

trades
Out[47]: 
                         price_AAPL  price_BOOB  price_GOOG  price_MSFT  \
time                                                                      
2016-05-25 13:30:00.023         NaN         NaN         NaN       51.95   
2016-05-25 13:30:00.038         NaN         NaN         NaN       51.95   
2016-05-25 13:30:00.048        98.0      720.92      720.77         NaN   

                         quantity_AAPL  quantity_BOOB  quantity_GOOG  \
time                                                                   
2016-05-25 13:30:00.023            NaN            NaN            NaN   
2016-05-25 13:30:00.038            NaN            NaN            NaN   
2016-05-25 13:30:00.048          100.0          100.0          100.0   

                         quantity_MSFT  
time                                    
2016-05-25 13:30:00.023           75.0  
2016-05-25 13:30:00.038          155.0  
2016-05-25 13:30:00.048            NaN 

JSON请求。

{"errors":{"variant":"expected Array to be a Hash"}} 

我做错了什么?

1 个答案:

答案 0 :(得分:2)

这是因为你发送了一系列变种。您必须单独add each variant

POST /admin/products/{product_id}/variants.json

{
    "variant": {
        "option1": "BROWN",
        "price": "49.05",
        "sku": "BA1015_BROWN_XS"
     }
}

只有在creating a new product时才能传递变种数组。