Categories
CMS Magento Mastering Development

how to show stock quantity on module-catalog-widget (luma theme, grid.phtml)

I try to show product quantity on module-catalog-widget (grid.phtml) by using the below code (Magento 2.3) <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $StockState = $objectManager->get(‘\Magento\CatalogInventory\Api\StockStateInterface’); $qty = $StockState->getStockQty($_product->getId()); echo $StockState->getStockQty($_product->getId()); ?> It showed that We’re sorry, an error has occurred while generating this content. Please anyone help me, which code should be used on product widget front […]

Categories
CMS Magento Mastering Development

how to show stock quantity on module-catalog-widget (luma theme, grid.phtml)

I try to show product quantity on module-catalog-widget (grid.phtml) by using the below code (Magento 2.3) <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $StockState = $objectManager->get(‘\Magento\CatalogInventory\Api\StockStateInterface’); $qty = $StockState->getStockQty($_product->getId()); echo $StockState->getStockQty($_product->getId()); ?> It showed that We’re sorry, an error has occurred while generating this content. Please anyone help me, which code should be used on product widget front […]