- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to Set Default Attribute Set At Scale
Hello,
Please how do I set products without attribute to inherit the default attribute.
Background story:
I have about 300 attributes created without logic on my site.
Now i am trying to clean it up by deleting this attribute sets but I am worried about having products without any attributes at all.
So I want a scenerio where if an attribute set is deleted, the product inherits the default attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to Set Default Attribute Set At Scale
1. Find the id of "Attribute Set" in the 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. Re-index and Clear cache
LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to Set Default Attribute Set At Scale
Hello,
1. Please check your attribute set id, where you want to switch.
2. Get product id and use them to set the new attribute set.
$attributeSetId = 12; //set attributeSetId, In which you want to set the product. $product_id = 10; // product id of that product, whose attribute set you to want to change. $storeId = YOUR STORE ID; // store id of the product, where product exists. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->create('Magento\Catalog\Model\Product')->load($product_id); $product->setAttributeSetId($attributeSetId)->setStoreId($storeId)->save();
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to Set Default Attribute Set At Scale
@seopaykobo5726 wrote:Hello,
Please how do I set products without attribute to inherit the default attribute.
Background story: eTenet.com
I have about 300 attributes created without logic on my site.
Now i am trying to clean it up by deleting this attribute sets but I am worried about having products without any attributes at all.
So I want a scenerio where if an attribute set is deleted, the product inherits the default attribute
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to Set Default Attribute Set At Scale
@seopaykobo5726 wrote:Hello,
Please how do I set products without attribute to inherit the default attribute.
Background story:
I have about 300 attributes created without logic on my site.
Now i am trying to clean it up by deleting this attribute sets but I am worried about having products without any attributes at all.
So I want a scenerio where if an attribute set is deleted, the product inherits the default attribute
Rails allows us to change the type and set the default value of the attribute.