0

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

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();
?>
  • I have added this confiiguration in my custom module. How can i get values of this? – Magecode Jun 22 '18 at 6:47

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.