Toggle Nav
My Cart 0

Magento 2 Formatted Price

Magento 2 Formatted Price

You can use below code to getting a formatted price with currency symbol in Magento 2 website.

// Instance of Object Manager
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); 
// Instance of Pricing Helper $priceHelper = $objectManager->create(‘Magento\Framework\Pricing\Helper\Data’); //Your Price like $_product->getPrice(); $price = 5000; $formattedPrice = $priceHelper->currency($price, true, false); Output: $5,000.00
June 28, 2017
Did you like this post?
0
0