Skip to main content
1 of 3
Magento Learner
  • 2.1k
  • 3
  • 41
  • 90

Magento 2 When to create custom attribute programmatically and when via admin?

In Magento 2, we can add a custom attribute for a product either programmatically or via admin (Stores->Attributes->Product)

In my case, I need to just create a custom text field to hold some custom text for products.

Should I make this field programmatically - A custom module that include UpgradeData.php and ui_component, or should I create this custom field in Admin -> Stores -> Attributes -> product?

What's the best practice?

Magento Learner
  • 2.1k
  • 3
  • 41
  • 90