I've created a product with variations but they are not linked at the back end and won't show up on the product page unless i manually set them
$data = [
'title'=> 'ship your idea5',
'type' => 'variable',
'description' => 'Trying it out for real',
'short_description' => 'Pellentesque habitant.',
'categories' => [
[
'name' => 'Movies',
'slug' => 'movies'
],
[
'name' => 'Romance',
'slug' => 'romance'
]
],
'images' => [
[
'src' => 'http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_4_front.jpg',
'position' => 0
]
],
'attributes' => [
[
'name' => 'Color',
'position' => 0,
'visible' => true,
'variation' => true,
'options' => [
'Black',
'Green'
]
],
[
'name' => 'Size',
'position' => 0,
'visible' => true,
'variation' => true,
'options' => [
'S',
'M'
]
]
],
'default_attributes' => [
[
'name' => 'Color',
'option' => 'Black'
],
[
'name' => 'Size',
'option' => 'S'
]
],
'variations' => array(
array( 'regular_price' => '29.98',
'attributes' => array(
array( 'name'=>'Color', 'options'=>'Black' )
)
),
array( 'regular_price' => '29.98',
'attributes' => array(
array( 'name'=>'color', 'options'=>'Green' )
)
)
)
];
$client->products->create($data);
any help is highly appreciated