Actually in my case Salable Quantity is showing zero in product grid Magento 2.3.

Due to this issue, products are not showing in frontend. If anyone has any idea then please tell me.

For this re-indexing is also done but still Salable Quantity is showing zero(0).

Add and update Quantity programmatic but Salable Quantity is showing zero .

  • try to allow out of stock backorder and check if the products will be displayed. This is not a fix but at least to check wether the exact problem is the salable qty.
    – fmsthird
    Jan 8 '19 at 3:42
  • have you fixed it?
    – fmsthird
    Jan 9 '19 at 4:17
  • yes actually there was a permission problem in our server Jan 9 '19 at 4:52
  • Hi, Have you found out the issue?
    – Octopus
    Feb 6 '19 at 9:33
  • 1
    @Octopus,yes reindex worked always but there was permission in server then it is resolved Feb 6 '19 at 9:46

In DataBase, There was two typ,

  1. Tables


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

  • 1
    Thank you so much. After spending 2 hours I got the solutions from your answer. Thanks again. Jun 29 '19 at 15:33
  • @Savan its already created at my end. but still facing same issue Aug 15 '19 at 6:50
  • @insoftservice I am facing the same issue, did you get any idea? Oct 8 '19 at 10:07
  • @HardikVisa do you have this view at your end. If yes just try to execute it manually at my end it was given permission issue which got resolved by granting full permission. Oct 8 '19 at 12:12

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
  • This did the trick for me. I was struggling to remove negative salable quantity. Jun 24 '20 at 2:07
  • What will happen if there are current orders in production. Will re-indexing reduce the default stock for other items in orders after truncating the table?
    – hablema
    Apr 5 '21 at 8:10
  • In my case, I just run indexer command and QTY started showing perfectly!!! Thanks +1 , made my day :) Aug 26 '21 at 6:34

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 had to remove the DEFINER=root@localhost from @Thakur answer so here is what I used:

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`))) ;

Failure to remove it caused a privilege error.


Please try the below steps:

Admin -> Stores -> Inventory -> Stock -> Edit Default Stock -> Sales Channels -> select Main Website

It worked fine.

OR find the below link



I was facing the same issue, after creating the view by executing the below query my problem has been resolved.

CREATE ALGORITHM=UNDEFINED DEFINER=`{database_user_name}`@`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` 
         `cataloginventory_stock_status` `legacy_stock_status` 
              join `catalog_product_entity` `product` 
                  on ((`legacy_stock_status`.`product_id` = `product`.`entity_id`))
   ) ;

Another method to fix this would be to remove the patch from the patch_list and re-run the setup:upgrade to re-invoke the command.

The code responsible for creating the SQL SECURITY INVOKER can be found in Magento\InventoryCatalog\Setup\Patch\Schema\CreateLegacyStockStatusView.

You can remove the data patch from the patch list by searching running

select * from patch_list where patch_name = 'Magento\InventoryCatalog\Setup\Patch\Schema\CreateLegacyStockStatusView

Delete the record.

Re-run setup:upgrade setup:di:compile setup:static-content:deploy

Re-save the products with ZERO Salable Quantity either one by one or mass action via admin.



and the issue solved

Not the answer you're looking for? Browse other questions tagged or ask your own question.