5

enter image description here

where i can update the saleable quantity in magento 2.3 ..the above tab is showing blank.

And how to update saleable quantity programmatic

4
  • is it a fresh install? or an old installation migrated to the other server?
    – fmsthird
    Jan 14, 2019 at 11:09
  • migrated from 2.1 Jan 14, 2019 at 11:14
  • products visible on frontend or not?
    – fmsthird
    Jan 14, 2019 at 11:36
  • products are available in front end Jan 14, 2019 at 12:34

8 Answers 8

11

I have same issue with resolved, take inventory_source_item table backup first.

Run sql query:

INSERT IGNORE INTO `inventory_source_item` (source_code, sku, quantity, status)
select 'default', sku, qty, stock_status from (`cataloginventory_stock_status` as `lg` join `catalog_product_entity` as `prd` on((`lg`.`product_id` = `prd`.`entity_id`)))

Apply command:

php bin/magento indexer:reindex

php bin/magento cache:flush

1
  • I have Inventory_stock_1 but some product not able to add in cart. Error: Product that you are trying to add is not available. Jan 23, 2020 at 13:01
1

The most probable reason is that you did not assign your product to any Source. As soon as the product would be assigned Magento would calculate Salable product Quantity automatically.

Read more about Salable Quantity calculation and Inventory Management in Magento 2.3 here - https://docs.magento.com/m2/ce/user_guide/catalog/inventory-management.html

1

In Magento v2.3

If you want to use MSI:

Check inventory_reservation

https://github.com/magento-engcom/msi/wiki/Salable-Quantity-Calculation-and-Mechanism-of-Reservations

If you don't want to use MSI turn the All Magento Inventory Modules Disable :

https://devdocs.magento.com/guides/v2.3/comp-mgr/install-extensions/inventory-management-installation.html#disable-inventory-management

https://devdocs.magento.com/guides/v2.3/inventory/index.html

IN DataBase There was two type

1> Tables and

2> Views

also The issue is possibly caused When Import/Export DataBase Views Was Not Created in magento 2.3 So check Views and inventory_stock_1 table In DataBase.

1

Answer by manoj pal above worked for me. The inventory_source_item table was empty and required one-time population.

After setting up Inventory Stocks/Sources in the back end, I observed these problems with my installation that needed fixing:

  • You could not add a product to cart on front end. 'Product that you are trying to add is not available.'

  • In the back-end, in the product table, the 'Salable quantity' column was blank, i.e. nothing showing in the table cell.

  • In the back end, the 'Product Saleable Quantity' twistie on the product page was also blank. Nothing was visible.

  • When saving a product in the back-end, I observed this error in the var/log/debug.log:

    Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails CONSTRAINT INVENTORY_SOURCE_ITEM_SOURCE_CODE_INVENTORY_SOURCE_SOURCE_CODE FOREIGN KEY (source_code) REFERENCES inventory_source (source_code)), query was: INSERT INTO inventory_source_item (source_code, sku, quantity, status) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE quantity = VALUES(quantity), status = VALUES(status) [] []

Following instructions above by @manoj-pal fixed this, and I was able to add products to cart.

However, saleable quantity and the twistie was still blank in the admin back end! WTF. I then noticed the join table inventory_source_stock_link table was blank. Googling this took me to this post:

https://stackoverflow.com/questions/57213282/salable-quantity-in-magento-2-3-dont-show

I saw how he inserted the missing row into table inventory_source_stock_link. Once I had populated this table, the back-end product pages started to display 'Salable quantity' in both the table cell and the twistie.

I must say MSI shows lots of promise and capabilities but this upgrade to Inventory Management has been quite a drama!

0

The issue is possibly caused by the missing DB tables with connections/relations to the Product Table. The solution would be:

  • Check whether All DB Tables (including data) from the old DB are all copied to the new DB Schema.
  • Check if inventory_stock_1 Table does exist and is filled with data relating to your Product Table.
3
  • I have seen the table inventory_stock_1 and data also there Jan 14, 2019 at 13:01
  • check the qty it should not be blank or zero.
    – fmsthird
    Jan 14, 2019 at 13:03
  • All products having the qty Jan 14, 2019 at 14:10
0

In Magento 2.3 you need to configure inventory sources in addition to adding product quantity. Check following 2 things:

  1. Under Stores => Inventory => Sources you have at least one source available. If not then you found the problem. Add New Source with following (you can use different values here if you wanted):Name: Default Source, Code: default, under Address Data, select your store country & provide a zip code / postcode. Save & Continue
  2. Under Stores => Inventory => Stocks, if you don't have any records then click on Add New Stock button, Add Name: Default Stock, Websites: select the website and click Assign Source. Now select the default source that we created earlier. Click Save

Reindex catalogue php bin/magento indexer:reindex and clear the cache. This should do the trick.

0

What worked for me was creating a new inventory source and assigning it to my products. Not entirely sure what the issue was but it was related to the default source created from the sample data.

0

In my case, problem was in assigning products to Source. Check inventory_source_item table in your DB. If you can't find your product(-s) by SKU - try to regenerate this table items manually.

Warning - it might work only for single stores view.


  1. Make backup of your inventory_source_item table.
  2. Check what source_code is using in this table for products, if it has rows.
  3. Clear inventory_source_item table.
  4. Use this sql query to generate sources for all your products.(change source_code value from default to yours, if needed)

INSERT IGNORE INTO 'inventory_source_item'('source_code', 'sku', 'quantity', 'status') SELECT 'default', catalog_product_entity.sku , cataloginventory_stock_item.qty, 1 FROM 'catalog_product_entity' INNER JOIN 'cataloginventory_stock_item' ON catalog_product_entity.entity_id = cataloginventory_stock_item.product_id

Make sure you use table prefix if needed.

Reindex products

php bin/magento indexer:reindex

And flush cache

php bin/magento cache:flush

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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