Solve problem with \Magento\InventoryCatalog\Plugin\CatalogInventory\Model\ResourceModel\Stock\Status\AdaptAddStockDataToCollectionPlugin
In Magento without MSI, when method \Magento\CatalogInventory\Model\ResourceModel\Stock\Status::addStockDataToCollection is called with $isFilterInStock = false, it is left joining cataloginventory_stock_status table. Even if some product is absent in this table (e.g. Bundle product without any options), it is present in collection selection.
In Magento with MSI, plugin method \Magento\InventoryCatalog\Plugin\CatalogInventory\Model\ResourceModel\Stock\Status\AdaptAddStockDataToCollectionPlugin::aroundAddStockDataToCollection is inner joining inventory_stock_X tables. So, if some product is absent in this table (e.g. Bundle product without any options), it will be absent in collection selection. But, if we will use left join, collection selection will contain all products, present in database.
This problem must be solved.
Also unskip test variation in \Magento\Bundle\Model\Product\FixedBundleWithSpecialPriceCalculatorTest::testPriceForFixedBundle.
The best temporary fix I found is to update Model/ResourceModel/AddStockDataToCollection.php
The fix works the same way the addStockDataToCollection() does - if $isFilterInStock is "false", joinLeft is used. Otherwise, 'join' is used.
Determine method:
$method = $isFilterInStock ? 'join' : 'joinLeft';
Then, instead of
$collection->getSelect()->join()
use the new method:
$collection->getSelect()->$method()
This can be done with a composer patch.
Hi, this PR seems to solve the problem in a partial way: https://github.com/magento/inventory/pull/3085 however, the same logic should also apply to the case
$stockId === $this->defaultStockProvider->getId()
in the if statement