When your Magento 2 stores is bulked with too many attribute sets or while importing from older Magento to a newer version, you may face some issues like older attributes cannot fit the newer versions or attribute sets cannot be managed manually. Creating new attribute set and assigning attributes to this newly created attribute set may be a cumbersome task if done manually as you have to follow local development to live publication process. What if you can automate creating attribute set and assign attributes to it programmatically in Magento 2?! It seems like saving efforts and time, right? Today, MageComp has come up with the simplest way to create attribute set programmatically & assign attributes to it in Magento 2.

All you need to do is, go to Vendor/Extension/Setup/InstallData.php and paste this and it will work like charm to create attribute set automatically.

That’s it, if you have done everything properly, it will definitely create new attribute set with assigned attributes inside your Magento 2 store backend. Feel free to ask questions or send your feedback regarding this code through commenting.
Happy Coding!

Thanksgiving Play and Win

Click to rate this post!
[Total: 8 Average: 4]