I assume that the client couldn't proceed with items in the cart that aren't in stock, but even with a clean Magento installation, it's happening.
How could I solve or find the reason for this issue?
Whenever we will upgrade Magento 2.3.X version to Magento 2.4.3 at that time Multi-Source Inventory Issue happens. To solve that issue need to follow the below steps.
Step #1 First Disable all MSI extension
php bin/magento module:disable Magento_Inventory Magento_InventoryAdminUi Magento_InventoryApi Magento_InventoryBundleProduct Magento_InventoryBundleProductAdminUi Magento_InventoryCatalog Magento_InventorySales Magento_InventoryCatalogAdminUi Magento_InventoryCatalogApi Magento_InventoryCatalogSearch Magento_InventoryConfigurableProduct Magento_InventoryConfigurableProductIndexer Magento_InventoryConfiguration Magento_InventoryConfigurationApi Magento_InventoryDistanceBasedSourceSelectionAdminUi Magento_InventoryDistanceBasedSourceSelectionApi Magento_InventoryElasticsearch Magento_InventoryExportStockApi Magento_InventoryIndexer Magento_InventorySalesApi Magento_InventoryGroupedProduct Magento_InventoryGroupedProductAdminUi Magento_InventoryGroupedProductIndexer Magento_InventoryImportExport Magento_InventorySourceSelectionApi Magento_InventoryCache Magento_InventoryLowQuantityNotification Magento_InventoryLowQuantityNotificationApi Magento_InventoryMultiDimensionalIndexerApi Magento_InventoryProductAlert Magento_InventoryReservations Magento_InventoryReservationCli Magento_InventoryReservationsApi Magento_InventoryExportStock Magento_InventorySalesAdminUi Magento_CatalogInventoryGraphQl Magento_InventorySalesFrontendUi Magento_InventorySetupFixtureGenerator Magento_InventoryShipping Magento_InventoryShippingAdminUi Magento_InventorySourceDeductionApi Magento_InventorySourceSelection Magento_InventoryConfigurableProductAdminUi Magento_InventoryLowQuantityNotificationAdminUi Magento_InventoryBundleProductIndexer Magento_InventoryCatalogSearchBundleProduct Magento_InventoryCatalogSearchConfigurableProduct Magento_InventoryInStorePickupAdminUi Magento_InventoryInStorePickup Magento_InventoryInStorePickupQuote Magento_InventoryQuoteGraphQl Magento_InventoryVisualMerchandiser Magento_InventoryInStorePickupSalesAdminUi Magento_InventoryGraphQl Magento_InventoryAdvancedCheckout Magento_InventoryCatalogFrontendUi Magento_InventoryDistanceBasedSourceSelection Magento_InventoryInStorePickupApi Magento_InventoryInStorePickupGraphQl Magento_InventoryInStorePickupSales Magento_InventoryInStorePickupShipping Magento_InventoryRequisitionList Magento_InventoryInStorePickupFrontend Magento_InventoryConfigurableProductFrontendUi Magento_InventoryBundleImportExport
Step #2 Run bin/magento setup:upgrade
and magento s:s:d -f
command
Step #3: Check will inventory_source_item
and inventory_source_stock_link
table removed
Step #4: Enable all MSI extension
php bin/magento module:enable Magento_Inventory Magento_InventoryAdminUi Magento_InventoryApi Magento_InventoryBundleProduct Magento_InventoryBundleProductAdminUi Magento_InventoryCatalog Magento_InventorySales Magento_InventoryCatalogAdminUi Magento_InventoryCatalogApi Magento_InventoryCatalogSearch Magento_InventoryConfigurableProduct Magento_InventoryConfigurableProductIndexer Magento_InventoryConfiguration Magento_InventoryConfigurationApi Magento_InventoryDistanceBasedSourceSelectionAdminUi Magento_InventoryDistanceBasedSourceSelectionApi Magento_InventoryElasticsearch Magento_InventoryExportStockApi Magento_InventoryIndexer Magento_InventorySalesApi Magento_InventoryGroupedProduct Magento_InventoryGroupedProductAdminUi Magento_InventoryGroupedProductIndexer Magento_InventoryImportExport Magento_InventorySourceSelectionApi Magento_InventoryCache Magento_InventoryLowQuantityNotification Magento_InventoryLowQuantityNotificationApi Magento_InventoryMultiDimensionalIndexerApi Magento_InventoryProductAlert Magento_InventoryReservations Magento_InventoryReservationCli Magento_InventoryReservationsApi Magento_InventoryExportStock Magento_InventorySalesAdminUi Magento_CatalogInventoryGraphQl Magento_InventorySalesFrontendUi Magento_InventorySetupFixtureGenerator Magento_InventoryShipping Magento_InventoryShippingAdminUi Magento_InventorySourceDeductionApi Magento_InventorySourceSelection Magento_InventoryConfigurableProductAdminUi Magento_InventoryLowQuantityNotificationAdminUi Magento_InventoryBundleProductIndexer Magento_InventoryCatalogSearchBundleProduct Magento_InventoryCatalogSearchConfigurableProduct Magento_InventoryInStorePickupAdminUi Magento_InventoryInStorePickup Magento_InventoryInStorePickupQuote Magento_InventoryQuoteGraphQl Magento_InventoryVisualMerchandiser Magento_InventoryInStorePickupSalesAdminUi Magento_InventoryGraphQl Magento_InventoryAdvancedCheckout Magento_InventoryCatalogFrontendUi Magento_InventoryDistanceBasedSourceSelection Magento_InventoryInStorePickupApi Magento_InventoryInStorePickupGraphQl Magento_InventoryInStorePickupSales Magento_InventoryInStorePickupShipping Magento_InventoryRequisitionList Magento_InventoryInStorePickupFrontend Magento_InventoryConfigurableProductFrontendUi Magento_InventoryBundleImportExport
After enable run magento s:up command.
Step #5: Now you need to create Source. Go to admin side Store >> Inventory >> Source and create "default" source.
Step #6: Now you need to create Stocks. Go to admin side Store >> Inventory >> Stock and create "Default Stock". After assigning a source if the source will not assign then you need to assign it using the SQL query that is provided in Step #8.
Step #7: Run the below 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`)))
Step #8: Run the below query to link source to stock
INSERT INTO `inventory_source_stock_link` (`link_id`, `stock_id`, `source_code`, `priority`) VALUES ('1', '1', 'default', '1');
Step #9: Run reindex command php bin/magento indexer:reset && php bin/magento indexer:reindex
It might be happening because you have the option Enable Inventory Check On Cart Load disabled, you can find it on the admin page below.
Admin > Stores > Configuration > General > Catalog > Inventory > Stock Options
This option determines if an inventory check is performed when loading a product in the cart. It is enabled by default.
Disabling the inventory check can improve performance for checkout steps, especially when there are many items in the cart. But if this inventory check is skipped, some out-of-stock scenarios could throw other types of errors, including:
Likely the issue related to inventory source status...
Run this query in your db and see if the item you're trying to add to cart has status of 0
select * from inventory_source_item where status = 0;
Changing status to = 1 should hopefully resolve
Actually the best way to remove the MSI and will solve your problem directly.
composer require yireo/magento2-replace-inventory
Reference: