Quick Ways To Get Formatted Price With Currency in Magento 2

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.

Sanjay Jethva

Article by

Sanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for...