Is their any way we can get the lowest price from product collection ?
I have array of products id
Array
(
[0] => 662348
[1] => 659160
)
I want the minimum & maximum price of products. min price product & max price product.
I have tried
$proIds=array(2,6,7);
$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());