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.

