in Magento 2.1, I would like to have the Category filter removed from the sidebar when in the shop category page, leaving the price filter untouched.

So far I have tried unsetting the category as anchor, which doesn't change anything. I am able to remove the whole sidebar with XML, but that's not ideal because I want to keep using the price filter.

  • Unsetting the category as anchor should work, have you tried at the store level as well? – Amit Naraniwal Feb 8 '19 at 7:13

Override view.phtml file in your theme





Now set condition for category before $filter->getItemsCount(),


if($filter->getName() != __('Category')) {


Final code looks like this

<?php $wrapOptions = false; ?>
<?php foreach ($block->getFilters() as $filter): ?>
    <?php  if($filter->getName() != __('Category')) : ?>
        <?php if ($filter->getItemsCount()): ?>
            <dt role="heading" aria-level="3" class="filter-options-title"><?php echo $block->escapeHtml(__($filter->getName())) ?></dt>
            <dd class="filter-options-content"><?php /* @escapeNotVerified */ echo $block->getChildBlock('renderer')->render($filter); ?></dd>
        <?php endif; ?>
    <?php endif; ?>
<?php endforeach; ?>
| improve this answer | |
  • This unfortunately did not work for me. – Martijnr Jun 4 '18 at 1:45
  • @Martijnr face any issue? – Prince Patel Jun 4 '18 at 5:02
  • This did not change anything. Any other suggestions Prince? – Martijnr Jun 4 '18 at 23:47

I am assuming you are referring cart page as shopping page.

In your theme, checkout_cart_index.xml add <referenceBlock name="catalog.leftnav" remove="true" /> as follows

<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        <referenceBlock name="catalog.leftnav" remove="true" />

Default Magento doesn't have layered navigation on cart page.

To remove it from every where you can use above in your theme default.xml or in catalog_category_view_type_default.xml

| improve this answer | |
  • I edited my post, what I mean is the shop category page. When I use your XML code, it removes the complete sidebar including the price filter. I only want the category filter to be removed. – Martijnr Jun 4 '18 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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