First of that get product collection :-
<?php
namespace ABC\HelloWorld\Block;
class HelloWorld extends \Magento\Framework\View\Element\Template
{
protected $_productCollectionFactory;
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
array $data = []
)
{
$this->_productCollectionFactory = $productCollectionFactory;
parent::__construct($context, $data);
}
public function getProductCollection()
{
$collection = $this->_productCollectionFactory->create();
$collection->addAttributeToSelect('*');
$collection->setPageSize(3); // fetching only 3 products
return $collection;
}
}
?>
Then use this block in your phtml and get price as per store vise currency :
$productCollection = $block->getProductCollection();
foreach ($productCollection as $product) {
$price=$objectManager->create('Magento\Framework\Pricing\Helper\Data')->currency(number_format($product->getPrice(),2));// store wise value can change with currency.
}
Hope it is useful for other.