Is their any way we can get the lowest price from product collection ?

I have array of products id

    [0] => 662348
    [1] => 659160

I want the minimum & maximum price of products. min price product & max price product.

I have tried

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    /** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection */
    $productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection');
    /** Apply filters here */
    $collection = $productCollection->addAttributeToSelect('*')
                ->addFieldToFilter('entity_id', array('in' => $proIds));

                echo '<pre>';print_r($collection->getData());

2 Answers 2


You can pass all the prices into empty array and then apply this function.

max(); min();


You can get min and max price from any collection :

Max Price : $maxPrice = $productCollection->getMaxPrice();

Min Price : $minPrice = $productCollection->getMinPrice();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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