I have a site where we have about 300 attribute sets that we are not using. I want to mass delete this attribute set but I can't find how to do that.

I will prefer an option where I can delete it from the interface.

2 Answers 2


Try This Code




namespace VendoreName\CustomizeAttributeSet\Controller\Adminhtml\Index;

use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;

class Save extends \Magento\Catalog\Controller\Adminhtml\Product\Set implements HttpPostActionInterface

    protected $attributeSetRepository;

    public function __construct(
        \Magento\Backend\App\Action\Context $context,
        \Magento\Eav\Api\AttributeSetRepositoryInterface $attributeSetRepository,
        \Magento\Framework\Registry $coreRegistry
    ) {
        parent::__construct($context, $coreRegistry);
        $this->attributeSetRepository = $attributeSetRepository;

    public function execute()
        $deletedAttributeCount = 0;
        $data = $this->getRequest()->getPostValue();
        $resultRedirect = $this->resultRedirectFactory->create();
        if (isset($data['attribute_list'])) {
            if (count($data['attribute_list'])) {
                foreach ($data['attribute_list'] as $key => $value) {
                    try {
                    } catch (\Exception $e) {
                        $this->messageManager->addErrorMessage(__('We can\'t delete this set right now. ID: ' . $value));
        $this->messageManager->addSuccessMessage(__('The ' . $deletedAttributeCount . ' attribute set has been removed.'));
        return $resultRedirect;

You can download module click here

Note: Every product must belong to a specific attribute set so please check before deleting the attribute set.


Dealing with a large number of unused attribute sets can be quite a task. Fortunately, we encountered a similar challenge and developed an extension to simplify the process. Our solution allows you to effortlessly mass delete attribute sets directly from the attribute set grid itself. You'll find the extension available on the Adobe Marketplace under the name "SoftNoesis Mass Attribute Set Deletion." Intrigued? Discover more about its functionality and benefits by visiting the following link: https://commercemarketplace.adobe.com/softnoesis-massattrsetdel.html. It's a game-changer for tackling this issue efficiently. Check it out for further insights!

Your Answer

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

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