Magento 2 – Get Minimum Qty Allowed in Shopping Cart Configuration Value

magento2

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.

Best Answer

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

<?php
  $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
  $stockObject = $objectManager->get('Magento\CatalogInventory\Api\StockRegistryInterface')->getStockItem($_product->getId());
  echo $stockObject->getMinSaleQty();
?>