How can I show the amount saved in Magento 2?

How can I show the amount saved in Magento 2?

September 10, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How can I show the amount saved in Magento 2?

Displaying Amount Saved on Magento 2 Product Catalog Page

As a senior developer working with Magento 2, I often encounter questions about displaying product pricing information on the catalog page. One common issue is calculating and showing the amount saved when a special price or final price applies.

In your scenario, you’re trying to display the savings amount in the final_price.phtml file of your theme. However, you’re not getting the calculation result displayed and are instead encountering an empty space on the page.

Let me guide you through resolving this issue step by step.

Understanding the Price Model

In Magento 2, the pricing for a product is determined by multiple factors such as special prices, tier prices, and custom price rules. The finalPriceModel represents the final calculated price, while the priceModel contains the original regular price.

To calculate the savings amount correctly, we need to compare these two values.

Modifying Your Code

Here’s how you can modify your code in the final_price.phtml file to properly display the amount saved:

<span class="special-price">
    <span class="only-text">Only: </span>
    <?php echo $block->renderAmount($finalPriceModel->getAmount(), [
        'display_label'     => __('Special Price'),
        'price_id'          => $block->getPriceId('product-price-' . $idSuffix),
        'price_type'        => 'finalPrice',
        'include_container' => true,
        'schema'            => $schema
    ]); ?>
</span>
<br />
<span class="old-price">
    <span class="rrp-text">RRP: </span>
    <?php echo $block->renderAmount($priceModel->getAmount(), [
        'display_label'     => __('Regular Price'),
        'price_id'          => $block->getPriceId('old-price-' . $idSuffix),
        'price_type'        => 'oldPrice',
        'include_container' => true,
        'skip_adjustments'  => true
    ]); ?>
</span>
<span class="saving-price">
    <span class="saving-text">Saving: </span>
    <?php
    $wasPrice = $block->renderAmount($priceModel->getAmount(), []);
    $nowPrice = $block->renderAmount($finalPriceModel->getAmount(), []);

    // Check if there is a saving amount
    if ($nowPrice < $wasPrice) {
        $saving = $wasPrice - $nowPrice;
        echo number_format($saving, 2); // Format the savings with 2 decimal places
    }
    ?>
</span>

Important Changes

  1. I added a check to ensure the current price ($nowPrice) is less than the original price ($wasPrice). This prevents negative savings from being displayed.

  2. To format the saving amount, I used number_format($saving, 2). This ensures the result is rounded off to two decimal places for better presentation.

Conclusion

In this blog post, we explored how to correctly calculate and display the amount saved on a Magento 2 product catalog page. By properly comparing the final price model with the regular price model and formatting the output, you can now show accurate savings amounts to your customers.

Remember, when working with pricing in Magento 2, it’s crucial to understand the different price models and how they interact with each other.

For more detailed information on Magento 2 development, check out our comprehensive guides on Laravel Company.

Don’t hesitate to share this solution with your fellow developers or reach out if you have any further questions. Happy coding!

Magento 2 Catalog Themes Pricing

Our network