I have created few product attributes in custom module using UpgradeData.

Now if I disable my module then I how can I disable the product attributes as well.

1 Answer 1


You cannot do that automatically.
Actually, you cannot disable attributes at all.
But you can have and Uninstall.php similar to UpgradeData.php that is called when the module is uninstalled (not disabled).
You can put a cleanup script in there. But it only works if your module is installed via composer.
More details in the official documentation

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.