enter image description hereWe used "Promotions > Catalog price Rule " to give discounts for all products in our site.

for some category products we gave 20 % off and for some products we gave 10 % off.

i want to display percentage of discount on "product list " and "product view page" as like below

" [20 off]%"

please help me to find solution.


Here is how you can get the discount percentage.
Let's say $_product is the current product instance:

$originalPrice = $_product->getPrice();
$finalPrice = $_product->getFinalPrice();
$percentage = 0;
if ($originalPrice > $finalPrice) {
    $percentage = ($originalPrice - $finalPrice) * 100 / $originalPrice;

if ($percentage) {
    echo $this->__('You save %s', $percentage . '%');

for the product list you can integrate this in the foreach loop that lists all products and on the product view page you can add it anywhere.

  • it will work only simple product type – HaFiz Umer Nov 18 '19 at 14:08

use it

<?php // Display Discount percents start ?>
  <span class="label"><?php echo $this->__('MRP:') ?></span>  <?php echo  $_price1= $_product->getPrice() ;?><br>
  <span class="label"><?php echo $this->__('Price:') ?></span> <?php echo $_finalPrice1= $this->helper('checkout')->formatPrice($_item->getPrice()) ;  ?>
     <span class="label"><?php echo $this->__('You Save:') ?></span><?php echo $_savingPercent==$_price1-$_finalPrice1; ?>%
    <?php if($_finalPrice1 < $_price1): ?>
    <?php $_savingPercent = 100 - round(($_finalPrice1 / $_price1)*100); ?>
        <p class="special-price yoursaving">
            <span class="label"><?php echo $this->__('You Save:') ?></span>
            <span class="price">
                <?php echo $_savingPercent; ?>%
    <?php endif; ?>
<?php // Display Discount percent end ?>
  • 1
    Fatal error: Call to a member function getPrice() on null – Andhi Irawan Nov 29 '16 at 7:13

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.