How to Configure, Customize, and Disable Layered Navigation in Magento 2

In Magento 2, layered navigation is an essential feature that allows customers to filter products based on various attributes like color, size, price, etc. You can configure, customize, and disable layered navigation using the Magento Admin Panel.

Magento 2 Layered Navigation is a site tree and channel that permits customers to look through items more handily. Store administrators can set it up in the left section or in the bar over the page.

Due to layered navigation magento 2 , users can look for reasonable items in an efficient manner. For instance, when a customer visits your site to search for shoes, he can utilize the filter with product attributes, for example, brand name, size, color, and cost.

Here’s a step-by-step guide

Precondition:

  • You need access to the Magento Admin Panel with appropriate permissions to make configuration changes.
  • Understand how products and attributes are managed within the Magento catalog. This includes creating and managing attributes that you intend to use for layered navigation.
  • Understand the different settings available for attributes, particularly the Use in Layered Navigation setting, which determines whether an attribute is available for layered navigation.

1. Configure Magento 2 Layered Navigation:

  • Log in to your Magento Admin Panel.
  • Go to Stores > Configuration.
  • Under Catalog, select Catalog again.
  • Expand the Layered Navigation section.
  • Configure options like:
    • Display Product Count: Choose whether to display the number of products next to each filter option.
    • Price Navigation Step Calculation: Configure the price ranges for the price filter.
    • Allow Multiple Select: Decide whether customers can select multiple options within a filter.

2. Customize Magento 2 Layered Navigation Filters:

  • Navigate to Stores > Attributes > Product.
  • Choose the attribute you want to customize for layered navigation (e.g., color, size).
  • Edit the attribute.
  • In the Storefront Properties tab, ensure that the option Use in Layered Navigation is set to Filterable (with results) or Filterable (no results) depending on your preference.
  • Save the attribute.

3. Customize the Layered Navigation Magento 2 Template (Optional):

  • You may want to customize the appearance of the layered navigation in your Magento theme.
  • Locate the template file responsible for rendering layered navigation. This is typically found in app/design/frontend/{Vendor}/{Theme}/Magento_LayeredNavigation/templates.
  • Customize the template file according to your requirements.
  • Be cautious when customizing templates and consider creating a child theme to avoid losing changes during theme updates.

4. Disable Magento 2 Layered Navigation:

Layered navigation is an exceptionally helpful component of Magento. In any case, if for some reason you want to disable it, there are a few things that you can do.

  • One can edit their categories and ensure they are not anchored. To do this, in the admin panel of your Magento go to Catalog>Manage Categories, then select the category on the left, Display Settings tab, and from the settings that appear make sure that the Is Anchor option is set to No. however, subcategories will still be shown in the layered navigation menu on the front end with this approach.
  • If you want to disable layered navigation altogether:
  • Add this to your theme default.xml
    • <referenceBlock name="catalog.leftnav" remove="true" />

Or

  • Add the file catalog.xml into your theme

public_html/app/design/frontend/base/default/layout/catalog.xml. In the file find and comment the following code:

<reference name="left">

<block type="catalog/layer_view" name="catalog.leftnav" 

after="currency" template="catalog/layer/view.phtml"/>

</reference>
  • To remove layered navigation from search
    • <referenceBlock name="catalogsearch.leftnav" remove="true" /
  • You can also disable specific attributes from appearing in layered navigation by editing their properties as mentioned in step 2 and setting Use in Layered Navigation to No.

5. Reindex and Clear Cache:

  • After making any changes to the layered navigation configuration or attributes, it’s important to reindex your Magento store and clear the cache to ensure that changes take effect properly.
  • You can reindex and clear cache from the command line or through the Magento Admin Panel (System > Tools > Index Management and System > Cache Management).

By following these steps, you can configure, customize, and disable layered navigation in Magento 2 according to your requirements.

The frontend category page displays layered navigation in Magento 2 store:

How to Configure, Customize, and Disable Layered Navigation in Magento 2

Conclusion

Magento 2 layered navigation offers a powerful tool for enhancing the user experience and improving product discoverability on your e-commerce store. Layered navigation in magento 2 is a valuable feature that can significantly enhance your store’s usability and customer satisfaction when implemented thoughtfully. By leveraging its customization options and monitoring its impact on performance and SEO, you can create a seamless browsing experience that drives conversions and fosters customer loyalty.

FAQs

Q: Remove Magento 2 Layered navigation?

1) Go to the command line, where Magento is and run php bin/magento module:uninstall Magento_LayeredNavigation

2) Remove the old cache/and generated content: rm -rf var/cache/* pub/static/frontend generated/code/*

3) Re-Index: php bin/magento index:reindex

4) If needed, clear the cache and refresh.

on the off chance that you miss it and need it back, or if removing causes problems, then re-enable it using:

php bin/magento module:enable Magento_LayeredNavigation

Q: What is the default Layered navigation in Magento 2?

The default layered navigation in Magento 2 is a bunch of filters (like color, size, price, and brand) that customers use to make more exact searches. It’s ordinarily found on the left section of category pages and search results. 

Q: How to enable Magento 2 Layered navigation?

Follow these steps to enable layered navigation in Magento 2:

  • Log in to your Magento Admin Panel.
  • Go to Stores > Configuration.
  • Under Catalog, select Catalog again.
  • Expand the Layered Navigation section.
  • Set “Yes” for Display Product Count to show the number of products found for each attribute

Save the configuration

Source: https://ecommerce.folio3.com/blog/how-to-configure-customize-and-disable-layered-navigation-in-magento-2/



You might also like this video