
Magento Compare Products: Why & How to Disable It Completely
Magento’s built-in “Compare Products” feature can clutter your UI and slow page loads. Disabling it streamlines the shopping experience, guides customers to purchase faster, and removes unused scripts—boosting both UX and SEO.
Why You Might Want to Disable “Compare Products”?
- Simplify the UI: Remove extra buttons and links from product/category pages.
- Improve UX: Keep customers focused on buying, not comparing.
- Boost Performance: Eliminate unnecessary frontend code for faster loads.
Step-by-Step Guide to Completely Disable “Compare Products”
Step 1: Remove Default Compare Blocks via XML
Magento uses layout XML to render blocks. In your child theme, create or edit:
app/design/frontend/<Your_Theme>/Magento_Catalog/layout/default.xml
Add this:
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="catalog.compare.sidebar" remove="true"/> <referenceBlock name="category.product.addto.compare" remove="true"/> <referenceBlock name="catalog.product.link.compare" remove="true"/> <referenceBlock name="catalogsearch.product.addto.compare" remove="true"/> <referenceBlock name="view.addto.compare" remove="true"/> <referenceBlock name="related.product.addto.compare" remove="true"/> <referenceBlock name="upsell.product.addto.compare" remove="true"/> <referenceBlock name="product.info.addto.compare" remove="true"/> <referenceBlock name="product.compare.link" remove="true"/> </body> </page>
Step 2: Hide Any Remaining Buttons via CSS/Less
Some themes may still render compare buttons via JS or templates. Hide them completely:
app/design/frontend/<Your_Theme>/web/css/source/_extend.less
.action.tocompare, .compare, a[href*="product_compare"], li[class*="compare"] { display: none !important; }
Step 3: Deploy Your Changes
Apply via CLI (from Magento root):
bin/magento setup:upgrade bin/magento setup:static-content:deploy -f bin/magento cache:clean
Verifying the Removal
- Check category pages—no compare links.
- Inspect product detail pages—compare button gone.
- Search results—compare options removed.
Tip: Test in a private/incognito window or clear browser cache to see updates.
Further Enhancements
Disabling “Compare Products” declutters your store—ideal for niche or single-product shops. This method works on Magento 2.4.7+ and most themes. Want more custom optimizations? Our Magento experts at Private DevOps are here to help!
Need Expert Help?
We’re here to support you and manage your tasks.