How to enable Layered Navigation in Magento 2 store
Layered navigation is one of the most popular Magento 2 features that lets your customers search items easily and quickly based on the price and relevant product attributes.
This documentation will guide you step by step to enable and manage Layered Navigation in your Magento 2 store. Let’s get started.
What is Layered Navigation
Layered Navigation in Magento 2 is a collection of one or more attribute (e.g price range, color, brand etc.,) which acts as a filter that customer can use to narrow the search. Layered navigation usually appears in the left column of Magento 2 category pages and search results pages.
Enhanced Layered Navigation for Magento 2:
It is of vital importance for your Magento store to enable your visitors to jump directly to whatever they are interested in. If you are seeking for a vast improvement over default Magento layered navigation, take a look at our UB Instant Layered Navigation extension.
It provides a richer UX for your store with a number of interactive elements for faster and more dynamic product searching, including multiple-categories filter, multiple-attribute filter, visual price slider, visual color switch etc.,
How to enable Layered Navigation in Magento 2
1. Filterable Attributes
Before setting up basic layered navigation, it is important to understand the requirements and a few terms associated with Magento 2 layered navigation.
- The layered navigation is only enabled with attribute with ‘Catalog Input Types’ of Dropdown, Multiple Select or Price
- Default Magento 2 layered navigation displays on Anchor Category only (and on Quick Search results pages only).
- Anchor Category: Categories which displays layered navigation are called Anchor Categories. By default, every category you create in Magento 2 is a non-anchor category. If you wish customers to use layered navigation for a category, you must set the Anchor with ‘On’ for such category.
Step 1: Set Up the Attribute Properties.
In the Admin Panel, navigate to Store > Attributes > Product. Then open attribute in edit mode.
For each attribute you wish to include in layered navigation, the following settings must be enabled:
- Use In Layered Navigation (required) must be set with either ‘Filterable (with results)” or ‘Filterable (no results)’
-- Filterable (with results): The layered navigation only shows the attribute values that apply to the products. Filters with no products that match the filter value will be hidden.
-- Filterable (no results): Lists all attribute values, even those with no products associated to it. Layered navigation appears on a category page only if there are filterable attributes available. - Use in Search Results Layered Navigation (optional setting) is set to ‘Yes’
For instance, a sample setting of the Color attribute included in the layered navigation:
Repeat these steps for each attribute that you want to include in layered navigation.
Step 2: Make the Category an Anchor
For every category that you want to use layered navigation, you have to edit the display settings of the category to enable Anchor setting as follows:
- Navigate to Admin Panel, Products > (Inventory) Categories.
- Open the category as you need to apply layered navigation.
- On the Display Settings tab, set the Anchor field to Yes.
- Click button Save Category to complete.
Once done, refresh the cache (via your admin Panel > System > (Tools) Cache Management ). Then go to your storefront and choose the category in the top navigation, you should see the layered navigation with associated filterable attributes.
Price Navigation
Beside the possibility to search by category or attribute, you can use price navigation in layered navigation.
Configuring price navigation:
1. On the Admin Panel, navigate to Store > (Settings) Configuration
2. Choose Catalog (under Catalog in the left sidebar panel) > Layered Navigation
3. Tab the Layered Navigation section, then:
Set Display Product Count to ‘Yes’, if you want to show the number of products in parentheses after each filtered item.
Next, set Price Navigation Steps Calculation to one of the following methods:
- Automatic (Equalize Price Ranges): this setting uses the standard algorithm which automatically calculates price navigation steps. So simply leave Price Navigation Steps Calculation set to the default, ‘Automatic (Equalize Price Ranges.).
- Automatic (equalize product counts)
-- Set Price Navigation Steps Calculation to Automatic (equalize product counts).
-- (Optional) If you have multiple products with the same price and you want to display this single price, set Display Price Interval as One Price to Yes
-- Then fill in the Interval Division Limit field the threshold for a number of products within a price range (The range cannot be further split beyond this limit). Default value is 9.
- Manual
-- Set Price Navigation Steps Calculation to Manual
-- Next, Enter a value to determine the Default Price Navigation Step.
-- Then enter the Maxium Number of Price Intervals (Maximum is 100).
Once done, click Save Config, then refresh the cache (via your admin Panel > System > (Tools) Cache Management).