Showing results for 
Search instead for 
Did you mean: 

Magento 2.3 Update Stock via Database - Multi Source Inventory


Magento 2.3 Update Stock via Database - Multi Source Inventory

I was hoping to get a grasp on the how Stock levels(Qty of a sku in stock) are stored in the database with the changes to MSI. Now that we have stocks and sources I'm unsure what all tables we need to update when making direct stock changes to the database.

My understanding is that inventory stock qty is stored in both cataloginventory_stock_item and cataloginventory_stock_status. Here is a example edit to these to change inventory levels.

UPDATE cataloginventory_stock_item item_stock, cataloginventory_stock_status status_stock SET item_stock.qty = '$qty', item_stock.is_in_stock = IF('$qty'>0, 1,0), status_stock.qty = '$qty', status_stock.stock_status = IF('$qty'>0, 1,0) WHERE item_stock.product_id = '$product_id' AND item_stock.product_id = status_stock.product_id

So, now that we have Sources that the inventory needs to come from. Where is that information stored? I believe the table is inventory_source_item. This list both the source_code, qty, and stock status by SKU. Is it as simple as making the same changes to the appropriate sku/source in this table? Is there possibly any other changes to tables that need to be updated for the new stock qty?