參考來源

Customize Layered Navigation Filter

Let’s customize the layered navigation filter in your Magento 2 store to better suit your product range and customer needs.

Using Filterable Attributes

Incorporate filterable attributes into your layered navigation to allow customers to narrow down their product search based on specific product characteristics.

Step 1: Navigate to Store → Attributes → Product.

Step 2: Select the attribute you want to include in the layered navigation, for example, the Cost attribute.

Step 3: Navigate to the Storefront Properties section of the Attribute Information.

Step 4: From the Use in Layered Navigation dropdown, select Filterable (with results) to display the number of products in the category associated with this attribute.

Step 5: Set Use in Search Results Layered Navigation to Yes for this attribute to appear on search results pages.

Step 6: Click Save Attribute to apply changes.