Sometimes we want the formatted price in phtml file. But in Magento 1 we could directly wrote using core module file.

So you might think, is it possible in Magento 2?

Yes, it is possible but there are different way to access this.

Magento 2 gives the formatted price in 2 core modules:

1. Checkout
2. Sales/Order

  • If we want the formatted price in checkout page, we can write this code:

  • If we want the formatted price in Sales/Order page, we can write this code:

Now refresh the page and check the formatted price.

Hope you liked it.

Share this post to spread the knowledge.