how to remove compare product and my cart from right side bar in magento

how to remove compare product and my cart from right side bar in magento

August 4, 2026 · Illustrated author avatarBy Stefan Bogdanescu
how to remove compare product and my cart from right side bar in magento

Removing Compare Products and Cart from Right Sidebar in Magento

As a seasoned Magento developer, I understand how frustrating it can be when you want to customize your store’s layout but face unexpected behavior after making changes. In this post, we’ll tackle the common issue of removing the compare products sidebar and cart module from the right panel while ensuring they don’t appear elsewhere in the theme.

The Issue: Why It Persists After Catalog.xml Changes

You’re on the right track by editing your catalog.xml file to remove the block reference for catalog/product_compare_sidebar. However, Magento themes are complex with multiple XML layouts being loaded together. This is why you might still see the sidebar appearing in places other than just the category view.

Understanding Magento’s Layout System

Before diving into the solution, it helps to understand how Magento loads layout files:

  1. app/design/frontend/{your_package}/{your_theme}/layout/catalog.xml (Your custom theme)
  2. app/design/frontend/base/default/layout/catalog.xml (Base layout file)

When a page is loaded in Magento, both files are merged together with your custom changes taking precedence over the base file.

Step-by-Step Solution

To completely remove the compare sidebar and cart module from all pages:

  1. Remove the Block Reference: Update your catalog.xml to remove the following block references entirely:
<reference name="right">
    <block type="catalog/product_compare_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
</reference>
  1. Clear Cache: Don’t forget to clear your cache after making changes:

    • Magento 1: Go to System > Cache Management and click “Flush Cache Storage”
    • Magento 2: Go to System > Tools > Cache Management and click “Flush Magento Cache”
  2. Check for Additional References: Sometimes, the block references might be duplicated in other layout files like app/design/frontend/{your_package}/{your_theme}/layout/default.xml. Make sure to check these files as well.

  3. Override Core Templates (Advanced): If you want a more robust solution that prevents the sidebar from being added again through core Magento functionality, consider overriding the relevant templates or controllers:

    • Override the Category Controller: In your custom theme’s controllers folder under your package and theme directory, create a new file called CategoryController.php. Override the _addProductCompareLink() method to remove the compare sidebar.
public function _addProductCompareLink($product)
{
    return '';
}
  • Override the Category View Template: Create a new file at app/design/frontend/{your_package}/{your_theme}/template/catalog/category/view.phtml and remove any references or blocks that add the compare sidebar.

Conclusion

Removing the compare products sidebar and cart module requires a careful approach to Magento’s layout system. By understanding how layout files are merged and clearing cache appropriately, you can achieve your desired result without compromising other parts of your theme.

Remember, customizing Magento is an iterative process. Be sure to test thoroughly after each change and consider using version control systems like Git to manage your changes safely.

For more advanced topics on Magento development, feel free to explore our in-depth tutorials and tips at https://laravelcompany.com/magento-development-tutorials.

Checkout Catalog Extensions Themes

Our network