In our previous Magento version, without MSI, we used the following code to display the total qty.


Sadly this does not work anymore with MSI enabled.

How can we get the total stock (Salable Quantity) on the product page?

Found this solution, but it is dirty and I do not want to use objectManager in templates:

<?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $StockState = $objectManager->get('\Magento\InventorySalesApi\Api\GetProductSalableQtyInterface'); echo $StockState->execute($_product->getSku(), 6); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.