I'm trying to send a new variation to a Woocommerce product. It is correctly created except for the attribute.
I'm sending:
$data = ['sku'=> $confezione['CODART'],'price' => $confezione['PREZZO1'],'regular_price' => $confezione['PREZZO1'],'attributes' => [ ['id' => 3,'name' => 'confezionamento','slug' => 'pa_confezionamento','options' => $tipo ] ]];
and the [attributes] is empty
If I compile the variation manually the following attribute is created:
[attributes] => Array ( [0] => stdClass Object ( [id] => 3 [name] => confezionamento [slug] => pa_confezionamento [option] => FL 12 x 1 lt ) )
the attributes in product are:
[attributes] => Array ( [0] => stdClass Object ( [id] => 3 [name] => confezionamento [slug] => pa_confezionamento [position] => 0 [visible] => 1 [variation] => 1 [options] => Array ( [0] => FL 12 x 1 lt [1] => FL 12 x 750 ml [2] => TA 10 lt [3] => TA 20 lt [4] => TA 4 x 5 lt ) ) )
Where is my mistake?