Create a product and update stock/location


#1

Hi
Need to create new product and after that update location field in stock entry (I use approach as described here Set Warehouse bin name on set stock quantity)
All it works but there is one problem - when I create a product there is not stock_entries array in sellables property,
but if I wait ~5-15sec that array appears

so, is it possible to get stock_entries array immediately after product creation?

Thanks


#2

We only create stock_entries for each warehouse when the products page is opened, until then there won’t be any.

You have the sellable_id and warehouse_id already, so you could just make the stock entry request and create it.

Let me know if this helps!


#3

After product creation I don’t have warehouse_id
anyway I have only one warehouse for my whole project, so warehouse_id will be the same for all products

Thanks you Phil for your quick replies!