I wanted to add a product with variations using the wordpress/woocommerce api.
I can successfully add a product with images and attributes but cannot convert these attributes to variations.
Here is the code, i used using JSON format in postman or any api client.
I am able to add the product with attributes saved associated with the product. However the variations don't register nor does the variation price.
{ "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.",
"regular_price":"24",
"categories": [
{
"id": 9
},
{
"id": 14
}
],
"images": [
{
"src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_3_front.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",
"regular_price": "9.00"
}
]
}