12

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 – Hitesh Balpande 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 – Hitesh Balpande Feb 6 '19 at 9:46
18

IN DataBase There was two type 1> Tables and 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

  • 1
    Thank you so much. After spending 2 hours I got the solutions from your answer. Thanks again. – Kamlesh Solanki Jun 29 '19 at 15:33
  • 2
    +1 For Great Answer – Sanjay Gohil Jul 19 '19 at 10:31
  • @Savan its already created at my end. but still facing same issue – insoftservice Aug 15 '19 at 6:50
  • @insoftservice I am facing the same issue, did you get any idea? – Hardik Visa 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. – insoftservice Oct 8 '19 at 12:12
9

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

2

I had to remove the DEFINER=root@localhost from @Thakur answer so here is what I used:

CREATE ALGORITHM=UNDEFINED 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`))) ;

Failure to remove it caused a privilege error.

0

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

https://webkul.com/blog/get-salable-quantity-in-magento-2-3/

0

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` 
   FROM
   (
         `cataloginventory_stock_status` `legacy_stock_status` 
              join `catalog_product_entity` `product` 
                  on ((`legacy_stock_status`.`product_id` = `product`.`entity_id`))
   ) ;
-2

I just changed to STORE -> CATELOG -> INVENTORY -> PRODUCTS STOCK OPTIONS -> BACKORDERS -> Allow Qty Below 0

and the issue solved

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