In this post we are discussing on how to get the product stock qty in magento 2.

$productID = 100;
$websiteID = 1;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$StockState = $objectManager->get('\Magento\CatalogInventory\Api\StockStateInterface');
echo $StockState->getStockQty($productID, $websiteID);

Leave a Reply

Your email address will not be published. Required fields are marked *