如何在woocommerce restAPI中传递变体属性值

时间:2018-10-06 06:26:52

标签: wordpress cordova woocommerce woocommerce-rest-api

我在我的Cordova应用中使用woocommerce rest Apis,在“添加到购物车”部分中,api是:
https://{websit_url}/wp-json/wc/v2/cart/add?consumer_key={key}&consumer_secret={key2}

通过api的json正文是

{
    "product_id":"3022","quantity":"1","variation" : {
        "size" : "small",
        "color": "blue"
    }
}

在上述情况下,我得到了错误

{
    "code": "rest_invalid_param",
    "message": "Invalid parameter(s): variation",
    "data": {
        "status": 400,
        "params": {
            "variation": "Invalid parameter."
        }
    }
}

我该如何解决?

0 个答案:

没有答案