{"id":800,"date":"2020-02-06T12:00:15","date_gmt":"2020-02-06T12:00:15","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2020\/02\/06\/get-formatted-price-with-currency-in-magento-2\/"},"modified":"2025-05-22T15:02:06","modified_gmt":"2025-05-22T09:32:06","slug":"get-formatted-price-with-currency-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/get-formatted-price-with-currency-in-magento-2\/","title":{"rendered":"Quick Ways To Get Formatted Price With Currency in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method To Get Formatted Price With Currency In Magento 2:<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">use Magento\\Framework\\Pricing\\Helper\\Data\nprotected $priceHelper;\npublic function __construct(Data $priceHelper)\n{\n    $this->priceHelper = $priceHelper;\n}\npublic function getFormattedPrice($price)\n{\n    return $this->priceHelper->currency($price, true, false);\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s all.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Please share the solution with fellow Magento developers via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-800","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/800","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=800"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/800\/revisions"}],"predecessor-version":[{"id":15097,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/800\/revisions\/15097"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=800"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}