I am creating a product collection using some of the product IDs as per this code:

$data = \Magento\Framework\App\ObjectManager::getInstance()->create('Magento\Catalog\Model\ResourceModel\Product\Collection')

By looping the product collection I am getting the product entity by this method:

 $item = $data->getItemById($product['product_id']);

I am trying to get the final price of the product using the Magento 2 function $item->getPriceInfo()->getPrice('final_price')->getAmount()->getValue() but i am not able to get the correct final price(special/sale price).

Please note, I have commented the addFinalPrice() in the collection as this creates the issue while adding the tax amounts. Also, I do not want to use the product object by load() method as it takes too much time to process.

Please suggest.

Your Answer

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

Browse other questions tagged or ask your own question.