How to create Product attribute programmatically in Magento 2?

Magento 2, We can create product attribute programmatically using InstallData.php file. Using dynamically create product attribute save the time for creating attribute manually using 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?”

Add category attribute Programmatically in Magento 2.

We can create custom category attribute programmatically in Magento 2 using simple module. In our demo we have created a simple text field attribute for a category.

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.

Continue reading “Add category attribute Programmatically in Magento 2.”

Magento 2 – How to get all options of specific attribute type?

In Magento 2 we can get all options of specific EAV entity types attribute. In Magento 2 There are many native EAV Entity Types are available.

You can get all options of specific attribute, Let’s we take a catalog_product Entity Type.
We take Color attribute from Catalog_Product Eav Entity Types. Fetch all the options of color attribute.
Create Block file,

Call Function From Template file,

The result looks like,