Skip to content

stock

Auto Added by WPeMatico

Magento 2 show current stock for salable quantity on productpage

I have this code for showing if my product is in stock or not. <?php /* @var $block MagentoCatalogBlockProductViewAbstractView */?> <?php $_product = $block->getProduct() ?> <?php $stockstate = MagentoFrameworkAppObjectManager::getInstance()- >get(‘MagentoInventorySalesApiApiGetProductSalableQtyInterface’); $sale_qty = $stockstate->execute($_product->getSku(), 1); ?> <?php if ($block->displayProductStockStatus()): ?> <?php… Read More »Magento 2 show current stock for salable quantity on productpage