Open Maksold opened 7 months ago
Hi @Maksold. 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.
Preconditions
2.4.2-p2
and2.4.7-beta2
Steps to reproduce
Expected result
Actual result
Exception #0 (Magento\InventoryConfigurationApi\Exception\SkuIsNotAssignedToStockException): The requested SKU is not assigned to the given stock.
Exception stacktrace
This issue seems to happen when the default stock is not the original Magento stock but a newly created stock set as default for the Main website.
Additional Information
Upon further investigation, it appears the issue may be related to the logic in
\Magento\InventoryConfiguration\Model\GetStockItemConfiguration::execute
, specifically line 71, where there's a check$this->defaultStockProvider->getId() !== $stockId
. Altering the return value in\Magento\InventoryCatalog\Model\DefaultStockProvider::getId
from1
to2
(the ID of the new default stock) seems to resolve the issue. However, it's unclear if this change might affect other areas of the system. This behavior suggests a potential oversight in handling custom default stocks when 'Manage Stock' is set to 'No'.