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!
Hello Magento Friends, In today’s blog, I will explain How to Add Tooltip in Checkout…
MongoDB is a popular NoSQL database that offers flexibility and scalability when handling modern web…
In NodeJS, callbacks empower developers to execute asynchronous operations like reading files, handling requests, and…
Hello Magento Friends, In today’s blog, we will learn How to Show SKU in Order…
The "Buy Now" and "Add to Cart" buttons serve as the primary call-to-action (CTA) elements…
Hello Magento Friends, In Magento 2, the checkout process allows customers to choose multiple shipping…
View Comments
Thank you, but php bin/magento setup:upgrade, it show Nothing to import. What did I miss
InstallData is only read when installing the module, so bin/magento setup:upgrade does not update.
Delete your YourVendor_YourModule from the setup_module table and run bin/magento setup:upgrade again