How to get stock status by SKU Magento 2?

Magento 2, You can get stock status by Product SKU. If you want to load Stock details using SKU, you can get the details of the Stock related information.

You need to use Magento\CatalogInventory\Model\StockRegistry to fetch stock status.

Using Stock Status Data, You can get the stock related info at the Website level, Stock is in stock, Backorder status, Qty, ProductId, Min. Qty, Manage Stock and many other stock field data.

Get the stock status using SKU value as a method parameter,

When you debug the Stock data you got all the required information of the Product Stock.

One Reply to “How to get stock status by SKU Magento 2?”

  1. Is it right to use model of StockRegistry bypass of Inventory API Service Contract ?
    Even with using API interface MagentoCatalogInventoryApiStockRegistryInterface which StockRegistry implements, we still will use deprecated API.
    MagentoInventoryApiApi* should be used in this case.
    Also, your method getStockStatus returns ?MagentoCatalogInventoryApiDataStockItemInterface (since MagentoFrameworkExceptionNoSuchEntityException) instead of string.
    Thank you

Leave a Reply