By providing $product->getPrice() the result which I get is 29.0000. How can I fetch the price in correct format along with currency i.e $29. Please help.
Asked
Active
Viewed 243 times
1 Answers
1
By default product object return as float price value without currency symbol.
You can get price format with below syntax,
echo $this->helper('Magento\Framework\Pricing\Helper\Data')->currency( $product->getPrice(),true,false);
Using above syntax you can get price with currency format.
Rakesh Jesadiya
- 42,221
- 18
- 132
- 183
-
Could you tell me how can I get product url? – Bridgit Thomas Jul 05 '17 at 10:37
-
$product->getProductUrl() – Rakesh Jesadiya Jul 05 '17 at 10:40
-
But that didn't work for me. – Bridgit Thomas Jul 05 '17 at 11:02