![]() ![]() If it's your custom code that gets the wrong or missing stock item by product id - you should not use StockItemRepository and use \Magento\CatalogInventory\Api\StockRegistryInterface::getStockItem to get stock item by product id. I don't know what you want to disagree with. The primary key is not expected to match product identifier and exists on its own.Īnd there's another interface that allows to get a stock item by product id without knowing stock item id: \Magento\CatalogInventory\Api\StockRegistryInterface::getStockItem. ![]() This is because the stock item has a primary key (stock item id) and the repository operates with the primary key, which is the usual practice. My answer was that the behavior of the repository is correct. From what I see in the issue now, the question was that StockItemRepository returns stock item by stock item id and the author of the issue ( was expecting it to return stock item by product id.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |