[ad_1]
In postman , I tried to call /wp-json/wc/v3/products end point to create a variable product, but I got bellow response.
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): type",
"data": {
"status": 400,
"params": {
"type": "type is not simple."
},
"details": {
"type": {
"code": "rest_not_in_enum",
"message": "type is not simple.",
"data": null
}
}
}
}In the request, I send the exact the same body like the woocommerce REST API document without any change. https://woocommerce.github.io/woocommerce-rest-api-docs/?shell#product-properties
{
"name": "Ship Your Idea",
"type": "variable",
"description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
"short_description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
"categories": [
{
"id": 9
},
{
"id": 14
}
],
"images": [
{
"src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_4_front.jpg"
},
{
"src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_4_back.jpg"
},
{
"src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_3_front.jpg"
},
{
"src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_3_back.jpg"
}
],
"attributes": [
{
"id": 6,
"position": 0,
"visible": false,
"variation": true,
"options": [
"Black",
"Green"
]
},
{
"name": "Size",
"position": 0,
"visible": true,
"variation": true,
"options": [
"S",
"M"
]
}
],
"default_attributes": [
{
"id": 6,
"option": "Black"
},
{
"name": "Size",
"option": "S"
}
]
}But If I change the type from “variable” to “simple”, it will be created normally.
don’t know what is this issue, please help.
