TransWikia.com

How to add custom attribute in filter in Magento2?

Magento Asked by Bhagyashri Pawar on November 13, 2021

I wish to add custom product attribute “ABC” as a filter on the storefront, If the user selects that attribute value, the Corresponding result should become by using elastic search 6.5+.

Can anyone guide me on this?

Thanks

2 Answers

Step 1:

Complete Basic and Advanced Properties information

On the Admin panel, click Stores.

In the Attributes section, select Product

Click Add New Attribute button

In the Attribute Properties section, do the following

enter image description here

In the Default Label, enter a default label to indentify the attribute

In the Catalog Input Type for Store Owner field, select the type in input control to be used for data entry

Text Field

Text Area

Date

Yes/No

Multiple Select

Dropdown

Price

Media Image

Fix Product Tax

Visual Swatch

Text Swatch

enter image description here

Step 2: Manage Labels

enter image description here

Step 3: Describe the Storefront Propertiesm

enter image description here

Answered by Yuvraj Ariya InfoTech on November 13, 2021

Step 1: Set Up the Attribute Properties

  1. On the Admin sidebar, go to Stores > Attributes > Product.
  2. Find an attribute(ABC) in the list using the filtered search or browsing. Select the filter to open in edit mode.
  3. In the panel on the left,choose Storefront Properties. Then, set Use In Layered Navigation to one of the following:

    • Filterable (with results) : Layered navigation includes only those filters for which matching products can be found. Any attribute value that already applies to all products shown in the list should still appear as an available filter. Attribute values with a count of zero (0) product matches are omitted from the list of available filters. The filtered list of products includes only those that match the filter. The products list is updated only if the selected filter(s) change what is currently shown.

    • Filterable (no results) : Layered navigation includes filters for all available attribute values and their product counts, including those with zero (0) product matches. If the attribute value is a swatch, the value appears as a filter, but is crossed out. Price layered filtering is not supported by this option, and does not affect Price filters.

      1. Set Use In Search Results Layered Navigation to Yes.

Step 2: Make the Category an Anchor

  1. On the Admin sidebar, go to Catalog > Categories.
  2. n the categories tree on the left, select the category where you want to use layered navigation.
  3. Expand the Display Settings section. Then, set Anchor to Yes.
  4. Click Save.

Step 3: Test the Results

To test the setting, visit your store and navigate to the category from the main menu. The selection of filterable attributes appears in the layered navigation of the category page.

Search, filter, and review the displayed products.

Reference Link : Filterable Attributes

Answered by Supravat Mondal on November 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP