cancel
Showing results for 
Search instead for 
Did you mean: 

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

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

Can anyone tell what is the difference between this two?

2 REPLIES 2

Re: When to create custom attribute programmatically and when via admin in magento 2?

Hello @5d970acbb8c78 

 

hope you are asking for a product attribute.

 

Both are same but some time when we install module we need to add attribute into product level so most developers adding into install data, so when somebody install module it will create automatically.

 

Another thing you can defined the source model and backend for attribute while creating using module or programmable 

 

Hope it will help you.

 

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: When to create custom attribute programmatically and when via admin in magento 2?

@5d970acbb8c78 The basic difference is when you create the attribute programmatically you can provide the backend and source model.

 

Also when multiple developers are working on a project at that time we generally create it programmatically otherwise all the developers have to create it manually.

 

Thanks