1

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.

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.

  • Could you tell me how can I get product url? – Bridgit Thomas Jul 5 '17 at 10:37
  • $product->getProductUrl() – Rakesh Jesadiya Jul 5 '17 at 10:40
  • But that didn't work for me. – Bridgit Thomas Jul 5 '17 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.