How do I set the value for field_stock?
I found a solution to add the value to field_stock (Stock level).

$variation =  ProductVariation::create(['type' =&gt; 'default', 'sku' =&gt; $json['22107'], 'status' =&gt; TRUE, 'price' =&gt; $price]);
$variation-&gt;save();
//Stock
$stock = ['stock' =&gt; ['value' =&gt; 100]];
$var = \Drupal::entityManager()-&gt;getStorage('commerce_product_variation')-&gt;load($variation-&gt;id());
$var-&gt;set('field_stock', [$stock]);
$var-&gt;save();


My field_stock in database is empty but this code create a commerce_stock_transaction in database with my quantity.