inventory
inventory copied to clipboard
Multi Source Inventory (MSI) with Custom Stock & Custom Sources Cause Products to Disappear
Preconditions (*)
- Magento 2.4.3-p1
- Ensure "Display Out of Stock Products" is set to "No" (as per default Magento settings)
- Set products' visibility to "Catalog, Search"
Steps to reproduce (*)
- Create new inventory source (i.e. "Store 1")
- Create new inventory stock (i.e "Custom Stock")
- Set the "Main Website" to be a sales channel of the "Custom Stcok"
- Assign "Store 1" to be a source of "Custom Stock
- Unassign the "Default" inventory source from all products
- Assign the new inventory source "Store 1" to all products
- Add quantity to products ("Store 1") & mark those products as "In stock"
- Reindex the website & clear the cache
Expected result (*)
- Products with positive "salable quantity" should show in category pages
- Products with positive "salable quantity" should show in search
Actual result (*)
- Products with positive "salable quantity" don't show in category pages
- Products with positive "salable quantity" don't show in search
Please note: When "Display Out of Stock Products" is set to "Yes" then products with positive "salable quantity" do show in category pages & search. However, I don't want to show out of stock products so this is not a good solution.
Below you can see my custom stock setup:
Hi @uandiweb. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this
- Join Magento Community Engineering Slack and ask your questions in #github channel.
Do you happen to have gaps in your entity ids?
I just came here to report something similar to https://github.com/magento/magento2/issues/31224
Which is now happening specifically with MSI because of the plugin in module-inventory-catalog-search/Plugin/CatalogSearch/Model/Indexer/ChildProductFilterByInventoryStockPlugin.php
FYI it works when Show out of stock is set to yes because it checks that and returns without running the filter in the plugin:
if ($this->stockConfiguration->isShowOutOfStock($storeId) || empty($result)) {
return $result;
}
return $this->filterProductByStock->execute($result, (int)$storeId);