I'm using Magento 2.02 I've created my own theme called 'cff', which is based on Luma.

I'm trying to remove the catalog.compare.link block in top.links

The layout for this block seems to be defined in


And if I add

<referenceBlock name="catalog.compare.link" remove="true" />

in that file, then as expected the 'Compare Products' text disappears from the top.links block.

However, I know I'm not supposed to change vendor files. So I'm looking for the correct folder in which to create my own default.xml file to place the remove code:

I've looked everywhere in the documentation and online but cannot find this info. I've tried several locations, none of them work. I thought this one should work but it doesn't either:


Please can someone tell me where the override layout should go?

This is the code inside my overriding layout default.xml

<?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">
        <referenceBlock name="catalog.compare.link" remove="true" />
  • First of all pls upgrade to the latest version of Magento2 ( 2.1.5 ) and it should work normal. also if you are on development enviornment DON'T use static content deploy, that is for production, and on development you should use symlinks. Also don't forget to remove/refresh cache "php bin/magento cache:flush" in the root of your magento or from admin
    – Vlad Patru
    Commented Apr 10, 2017 at 0:35

3 Answers 3


You could try just removing the compare reference container: compare-link-wrapper

<referenceContainer name="compare-link-wrapper" remove="true" />

There is a little documentation regarding removing elements via layout xml but you can find it here: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-instructions.html

In regards to your question about where that file needs to live: You are correct in your assumption that we need to extend the default.xml by extending it in our theme's Magento_Catalog/layout/default.xml or Magento_Theme/layout/default.xml

I just tried using the exact same code you provided and had no problems removing the compare block I would double check that you cleared your caches and don't need to publish anything to your pub directory.

UPDATE 4/7/16:

You can refresh your pub directory by manually deleting the pub/static directory and then running the command:

  • Hi Tyler, I don't understand your first sentance. what is a 'compare reference container'? the code you give does not appear in /vendor/magento/module-catalog/view/frontend/layout/default.xml. I have tried the file in both the locations you suggest but it does not work. Please can you think of a reason why that might be? And finally, what do you mean 'publish anything to your pub directory? Shouldn't magento take care of everything in that folder? Sorry to be dim, the learning curve is bloody steep round these parts...
    – jdk
    Commented Apr 7, 2016 at 10:45
  • Sorry I forgot to say thanks for your answer Tyler! I really appreciate your help..
    – jdk
    Commented Apr 7, 2016 at 10:52
  • @jo I added some Commented Apr 8, 2016 at 0:52

In your theme folder go to Magento_Theme/layout folder first.

then create layout/override/base folder and add default.xml file from vendor and add <referenceBlock name="catalog.compare.link" remove="true" />.

  • no need to override , just update to latest version of Magento use the method he tryed already and maybe just remove cache
    – Vlad Patru
    Commented Apr 10, 2017 at 0:36

I tried removing referenceContainer sidebar.additional from product listing page. I did the following procedures.

  1. I just copied <referenceContainer name="sidebar.additional"> from \vendor\magento\module-catalog\view\frontend\layout\default.xml
  2. And put it under <body>. The code should be looking <referenceContainer name="sidebar.additional" remove="true"></referenceContainer> in app\design\frontend\theme\theme-name\Magento_Theme\layout\default.xml.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.