Magento 2 Get layered navigation filterable attributes list.

Magento 2 Get all the attribute list which are used in Layered Navigation in category page and search page.

You can get all the filterable attribute list by Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory class.

The result will be all those attributes that have,

  1. Use in Layered Navigation status are Filterable (with results)
  2. Filterable (no results)

Continue reading “Magento 2 Get layered navigation filterable attributes list.”

How to create Product attribute programmatically in Magento 2?

Up to Magento 2.2 Version, We can create product attributes programmatically using the InstallData.php file.

Using dynamically create product attribute save the time for creating attribute manually using the admin panel.

If you are creating an extension package and you need product attribute at that time below code snippet will be helpful for creating Product attribute.

Continue reading “How to create Product attribute programmatically in Magento 2?”

How to create category attribute Programmatically in Magento 2?

We can create custom category attributes with text fields programmatically in Magento 2 using a simple module.

In our demo, we have created a simple text field attribute for a category to save the value and use it on the front end.

You can see a category attribute in the backend using Catalog -> Categories Page.

Click on Any category and you can see our custom attribute in General Section after the category name.

If you are interested to create a drop-down select category attribute, Learn More Continue reading “How to create category attribute Programmatically in Magento 2?”