I have created custom attributes for the attribute sets namely set1 and set2.

I have created the products via script with attribute set name as set1. The products are saved successfully.

But Now I wish to change the attributeset name from set1 to set2.

Please provide me a solution how do i update the attribute set for the existing products while saving the product via programatically.


Try this code:

$attributeSetId = 12; //you can change as per your requirement.
$product_id = 10;
$storeId = YOUR STORE ID;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create('Magento\Catalog\Model\Product')->load($product_id);
  • I have done this for configurable product but it is not working
    – Jaisa
    Jun 6 '18 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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