magento disable cache for price block

magento disable cache for price block

July 6, 2026 · Illustrated author avatarBy Stefan Bogdanescu
magento disable cache for price block

Disabling Cache for Price Blocks in Magento Enterprise Edition

In dynamic pricing scenarios like yours, Magento’s full page caching can become a challenge as it prevents real-time updates from being reflected on the frontend. You’re correct that disabling cache specifically for price blocks is the solution here. Let’s walk through how you can achieve this effectively.

Understanding Magento’s Cache System

Magento uses various types of caches to improve performance, including block HTML output and full page caching (for EE). By default, many product-related blocks are cached, including catalog_product_price_template which renders the price for a specific product.

Locating the Relevant Block Definition

Your discovery is correct—you’ve found the relevant block definition in app/code/core/Mage/Catalog/etc/config.xml. The Mage_Catalog_Block_Product_Price_Template block responsible for rendering prices is defined here:

<block type="catalog/product_price_template" name="catalog_product_price_template"/>

Incorrect Attempts and Why They Failed

Your attempts to disable caching through layout XML files are commendable, but they didn’t work due to a few reasons. Let’s analyze why:

  1. Setting cache lifetime to null or false: This won’t work because Magento uses block-specific caching logic that doesn’t respect these values for certain blocks.

  2. Using setCacheLifetime action on incorrect blocks: You tried it on catalog_product_price_template which is the wrong target. The actual block responsible for rendering prices is Mage_Catalog_Block_Product_Price.

  3. Incorrect syntax and attribute names: Some of your attempts had minor syntax issues or were using the wrong attributes.

The Correct Approach: Disabling Cache via Override

The correct approach involves overriding the block class to disable caching programmatically. Here’s how you can do it:

  1. Create a custom module if you don’t have one already (let’s call it Your_Company_Price).

  2. In your module, create a file at app/code/local/Your/Company/Price/Block/Product/Price.php.

  3. Override the _isCacheable() method in this new file:

<?php
class Your_Company_Price_Block_Product_Price extends Mage_Catalog_Block_Product_Price
{
    protected $_cacheable = false;

    public function _isCacheable()
    {
        return false;
    }
}
  1. Clear your Magento cache and check if the changes are applied.

Handling Bundle Products

If you’re using bundle products, you’ll need to handle catalog_product_price block as well, which is defined in app/code/core/Mage/Bundle/etc/config.xml. The process for overriding this block is similar—create a new file at Your/Company/Price/Block/Product/Price.php, override the same _isCacheable() method, and clear your cache.

Best Practices

Remember these best practices:

  • Always work in the local code pool to avoid overwrites during updates.
  • Keep your overrides separate from core files.
  • Use version control for all your customizations.
  • Test changes thoroughly before deploying them to production.

Conclusion

Disabling cache specifically for price blocks involves a bit of digging into Magento’s architecture. By understanding where these blocks are defined and overriding them correctly, you can ensure real-time pricing updates without compromising the rest of the caching system.

Don’t forget to explore more about Magento customization techniques on our blog for advanced tips and tricks like this. Happy coding!

Catalog Cache Performance Themes

Our network