I'm running Magento 2.1.8. How can I get the minimum quantity allowed in shopping value in the code? I want to show this value in the product catalog template list.phtml file.

enter image description here

Edit: This is a global value that can be configured in Stores > Configuration > Catalog > Inventory.

2 Answers 2


Okay, I finally solved this problem. Here's the code.

  $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
  $stockObject = $objectManager->get('Magento\CatalogInventory\Api\StockRegistryInterface')->getStockItem($_product->getId());
  echo $stockObject->getMinSaleQty();
  • I have added this confiiguration in my custom module. How can i get values of this?
    – Magecode
    Jun 22, 2018 at 6:47

If you have the product object and do not want to use the other classes manually. You can try in the following way.

$prodObj = $_product->load($_product->getId()); // $_product object in list.phtml
$stockItem = $prodObj->getExtensionAttributes()->getStockItem();
$minSaleQty = $stockItem->getMinSaleQty();

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.