I have created my Attribute Set. Now all current & future products belongs to that Attribute Set Only.

So i want to set my "Attribute Set" as Default. Instead of Magento Default Attribute Set.

So when i'm going to Add New Product it will be Automatically Selected with my Attributes loaded. enter image description here

  • Also interested to see if there's an answer to this... Dec 29, 2016 at 16:26

2 Answers 2


1.Find id of "Attribute Set" in database column eav_attribute_set.attribute_set_id

2.UPDATE `eav_entity_type` SET `default_attribute_set_id` = '%YOUR_Attribute_Set_ID%' WHERE `eav_entity_type`.`entity_type_code` = 'catalog_product'; 3. reindex and clear cache

  • 1
    Thank you Magentobro :) And don't be sad, you're the man ! Mar 17, 2017 at 10:11
  • @SadMagento Thanks bro! you made my day. Jun 21, 2019 at 9:26
  • Just to point no reindex needed, clearing cache is enough Feb 15 at 13:49

Here is the php way to do it (and yes, I know you shouldn't use the objectmanager but I'm not going to explain that here). I'm making a one-off script that cleans up the mess from the migration thing. The code below removes the 'Migration_' attribute codes and assigns the lower values originally used, as well as deleting the new defaults. You can use this code as you see fit. The important part is calling the clear() function so magento doesn't use values from memory instead of reading your changes to the database.

echo "RUNNING";
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('memory_limit', '5G');

use Magento\Framework\App\Bootstrap;
require 'app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);

$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('Magento\Framework\App\State');

$scb = $objectManager->get('Magento\Framework\Api\SearchCriteriaBuilder');
$typeConfig = $objectManager->create('Magento\Eav\Model\Entity\Type');
$modelConfig = $objectManager->create('Magento\Eav\Model\Config');
$eavConfig = $objectManager->create('Magento\Eav\Api\AttributeSetRepositoryInterface');
$eavSetup = $objectManager->create('Magento\Eav\Setup\EavSetup');

$filter = $scb->addFilter('attribute_set_id',null,'neq')->create();
$list = $eavConfig->getList($filter)->getItems();

foreach ($list as $item) {
    $attributeSetName = $item->getAttributeSetName();
    $newItemName = explode('Migration_', $attributeSetName);
    if (is_array($newItemName) && count($newItemName) > 1) {
        $newItemName = $newItemName[1];
        if (strpos($item->getAttributeSetName(), 'Migration') !== false) {
            // See if attribute set name exists already
            // If yes
            // See if the attribute set ID is higher or lower
            // If lower, delete this one
            // If higher, delete found one and save this one.
            // If No
            // Save attribute set without "Migration_"
            foreach ($list as $innerItem) {
                if ($item != $innerItem) {
                    $innerAttributeSetName = $innerItem->getAttributeSetName();
                    if ($newItemName == $innerAttributeSetName && $innerItem->getEntityTypeId() == $item->getEntityTypeId()) {
                        if ($innerItem->getAttributeSetId() > $item->getAttributeSetId()) {
                            $type = $typeConfig->load($item->getEntityTypeId())
                                ->setData('default_attribute_set_id', $item->getAttributeSetId())

                            $resource = $innerItem->getResource();



  • 1
    thanks @CarComp - based off your script, I put up a quick module (didn't end up using much from your script other than the initial thought process) github.com/treestonemedia/postmigartion-magento-cleanup
    – Haim
    Jan 16, 2020 at 22:20
  • Thats all i ever intended. Thanks for your contributions!
    – CarComp
    Jan 21, 2020 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.