0

Magento 2.3.2 - I have set discount through Catalog Price Rule. And so in Catalog pages (Product Listing Pages)

there are two Prices displayed

1) Regular Price
2) Special Price (discounted Price).

My Problem is - Special Price is appearing in digit. i.e. Regular Price is 355.00 while Special Price is 312.40 I want to Round this Special Price as 312.00. How to achieve this.

Thanks

2 Answers 2

1

You can use PHP floor() Function for rounding price.

  $floored_price = floor($special_price);

Example:

enter image description here

Hope this help you, Thank you

32
  • i am new to this pl.let me know name of file & location of file with code to update.
    – Paresh
    Aug 20, 2019 at 7:28
  • which page you want to change price? Aug 20, 2019 at 7:48
  • Catalog pages (Product Listing Pages)
    – Paresh
    Aug 20, 2019 at 8:01
  • can you please upload listing page screenshot Aug 20, 2019 at 8:10
  • app/design/frontend/{theme}/{theme-classification}/Magento_Catalog/templates/product/price/final_price.phtml try this Aug 20, 2019 at 8:14
0

Used round Function

<?php
echo(round(0.60) . "<br>");  //output 1
echo(round(0.50) . "<br>");  //output 1
echo(round(0.49) . "<br>");  //output 0
echo(round(-4.40) . "<br>"); //output -4
echo(round(-4.60));          //output -5
?>
4
  • i am new to this pl.let me know name of file & location of file with code to update.
    – Paresh
    Aug 20, 2019 at 7:27
  • which page you want please attach screen shot Aug 20, 2019 at 7:37
  • Catalog pages (Product Listing Pages)
    – Paresh
    Aug 20, 2019 at 8:02
  • using theme or module ? Aug 20, 2019 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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