Sharing some useful tips, solutions and notes for Geeks.

Thursday, May 14, 2020

Bulk assign attributes to attribute sets programatically in Magento 2

When we have a lot of new attributes and need to assign those to all the attribute sets at once, below code will be useful.

So first you need to assign the attributes in an excel in below format and then upload to the document root as a csv file.

Then create a php file with below content, upload it to same document root and run.

Once done, all the attributes in the csv file will be loaded to "General" section inside all attribute sets. If its needed to load in General section, no code edits needed. Dont forget to change the csv file name with yours in code.


No comments: