Show Available Stock quantity for each product in Magento 2

<?php 
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $StockState = $objectManager->get('\Magento\CatalogInventory\Api\StockStateInterface');
    echo $StockState->getStockQty($product->getId(), $product->getStore()->getWebsiteId());
?>

Reference: https://magento.stackexchange.com/a/97952/32283


Posted

in

by

Comments

Leave a Reply

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