0

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?

2
  • check this link --- justwebdevelopment.com/blog/… Jul 27, 2020 at 18:20
  • Thanks for the resource. This is exactly how I knew it worked in the past. I feel now with the changes in 2.3 with MSI I think there is an addition table to modify. (The system needs to know what SOURCE to take the inventory from, even in a single source install its the default one). Any thoughts? Jul 27, 2020 at 19:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.