cancel
Showing results for 
Search instead for 
Did you mean: 

set stock per sources

set stock per sources

hey,

i want to update a product's stock for multiple sources/stocks in magento 2.3.1 from a script, something like this:

$product->setStockData(
[
'use_config_manage_stock' => 0,
'manage_stock' => 1,
'is_in_stock' => 1,
"source_code" => "xxxxxxx",
'stock_id' => 2,
'qty' => 1
]
);

 

but it ignores source_code. any ideas?

thanks