You can get formatted price with currency in Magento 2 using the block method. Convert a plain number into a price format with a currency symbol using any one of the solutions given below.
Method To Get Formatted Price With Currency In Magento 2:
use Magento\Framework\Pricing\Helper\Data
protected $priceHelper;
public function __construct(Data $priceHelper)
{
$this->priceHelper = $priceHelper;
}
public function getFormattedPrice($price)
{
return $this->priceHelper->currency($price, true, false);
}
That’s all.
Please share the solution with fellow Magento developers via social media.
Thank you.