1.8 (36.67%) 6 votes

In this tutorial I will add attribute “is featured” for all product types and is_featured is a boolean attribute that you can turn on or off.

Add Eav Attribute for Product
Add Eav Attribute for Product

Example write on UpgradeData.php file.

1. Declare eav setup factory

2. Add attribute

In this part:

  • is_featured: attribute code
  • group: group name for attribute that will display in backend
  • type: data type save in database
  • globar: the scope of attribute (store, website or global)
  • visible_on_frontend: true or false that allow the attribute is displayed on frontend or no
  • apply_to: product type that you want to add attribute

3. Remove an eav attribute for product

The steps I mention above is the shortest process for you to Add Eav Attribute for Product in Magento 2. With this guide, you can manage the Eav Attribute for Product in Magento 2 easily. Every store has a Eav Attribute for Product in Magento 2 with many attributes.

Thank you for reading this post and see you in other posts from Magestore!

Your Magento website needs a powerful Magento ERP for stock control.


magento erp

How to Change Product Image in Minicart in Magento 2 - Magento 2.3
*14. How to Edit Product Reviews in Magento 2? - Magento 2.3