Salable Quantity is showing zero in product grid magento 2?

In DataBase, There was two typ,

  1. Tables

  2. Views

The issue is possibly caused when Import/Export DataBase Views was not created in Magento 2.3. So create Views and inventory_stock_1 table in DataBase.

See Attached Image:

enter image description here


I skipped this line of query, due to Previllages error and my add to cart was not working on live server, in local server this line was not skipped and add to cart was working fine.

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `inventory_stock_1`  AS  select distinct `legacy_stock_status`.`product_id` AS `product_id`,`legacy_stock_status`.`website_id` AS `website_id`,`legacy_stock_status`.`stock_id` AS `stock_id`,`legacy_stock_status`.`qty` AS `quantity`,`legacy_stock_status`.`stock_status` AS `is_salable`,`product`.`sku` AS `sku` from (`cataloginventory_stock_status` `legacy_stock_status` join `catalog_product_entity` `product` on((`legacy_stock_status`.`product_id` = `product`.`entity_id`))) ;

Because the View was not created in the live server enter image description here


I'm gonna share my experience related to this issue, I hope it could help someone who would have been in the same situation.

We were working on a staged instance, all was ready to go to production. So we duplicated everything on the prod env and launched some SQL truncates in order to delete every dummy orders, reviews, etc.. you get the idea.

After some final tests, we realized that our products "stock qty" were far different from product "salable qty". The SQL View seemed to work fine, so we investigated deeper. Turns out we missed a SQL table in our truncate instructions :

TRUNCATE TABLE `inventory_reservation`;

This bad girl was containing each "not shipped but reserved products" from past orders.

Of course don't forget to reindex stuff :

bin/magento indexer:reindex;