We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    Today we are going to share that how to get the actual salable quantity on the product detail page?

    Let’s say our requirement is to show available qty on the site

    You can use the below code by using object manager directly use in your phtml file.

    <?php 
        $objectManager = MagentoFrameworkAppObjectManager::getInstance();
        echo __('Quantity available: '); 
        $StockState = $objectManager->get('MagentoInventorySalesAdminUiModelGetSalableQuantityDataBySku');
        $qty = $StockState->execute($_product->getSku());
        echo $qty[0]['qty'];
    ?>

    That’s it.

    field_5bfb909c5ccae

      Get a Free Quote