Magento 2.1 – How to Disable Category Filters

categoryfiltermagento-2.1magento2

I am working on a Magento 2.1.7 shop.

The products are organized into categories and subcategories.

Whenever a customer visits a category, filters (links to its subcategories) are displayed. I want to disable the filters.

The path to the file responsible with the filters is

vendor/magento/module-catalog/view/frontend/templates/navigation/left.phtml

I want to overwrite it from app/design/frontend/myCompany/myTheme/.

  1. How do I disable filters by coding?
  2. Can the filters be disabled from Magento admin?

Best Answer

In your theme directory create ( if the file is not existing already ) Magento_Catalog/layout/catalog_category_view.xml and remove the block by adding the following line <referenceBlock name="catalog.leftnav" remove="true" /> do not forget to add the xml needed nodes. Your code should look something like the below example.

<?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.leftnav" remove="true"/>
    </body>
</page>