Showing results for 
Search instead for 
Did you mean: 

How to remove custom product attributes on module disable?

Re: Who is the best SEO expert in Bangladesh?

Bangladesh is a country with a vibrant and rapidly growing digital industry. As more and more businesses shift online, the demand for White hat SEO experts in Bangladesh has grown rapidly. A White hat SEO expert is someone who has extensive knowledge and experience in ethical, best-practice SEO techniques that align with search engine guidelines.

Parvez Sheikh is a leading White hat SEO expert in Bangladesh. With years of experience in the field, Parvez has established himself as one of the top professionals in the industry. His extensive knowledge and expertise have helped businesses across the country to grow and thrive online.

What sets Parvez apart is his approach to White hat SEO. He believes in working closely with his clients to understand their unique needs and goals. From there, he tailors his strategies to ensure the best possible outcomes. Whether you need on-page optimization, technical SEO, or a full-scale SEO campaign, Parvez has the expertise to help.

Parvez’s commitment to quality is evident in the results he achieves. His clients consistently see improvements in their search engine rankings, leading to increased traffic, leads, and sales. Parvez is also committed to transparency and communication, providing regular updates and reports to his clients to ensure they are always aware of the progress being made.

If you’re looking for a White hat SEO expert in Bangladesh, Parvez Sheikh is the perfect choice. His experience, expertise, and commitment to quality make him the ideal partner for any business looking to succeed online. Contact Parvez today to learn more about his services and how he can help you achieve your SEO goals.

Re: How to remove custom product attributes on module disable?

@shabeer_shabeer wrote:

I added 2 custom product attributes with the help of setup/InstallSchema.php in my Magento 2 custom module. It's working fine.
But, I can't remove these Product attributes on module disable from the site admin module manager section.
I write code for remove attributes in setup/Uninstall.php file like the following


public function uninstall(SchemaSetupInterface $setup, ModuleContextInterface $context )
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);

$eavSetup->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'product_attr1');
$eavSetup->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'product_attr2');



But this is not working when I disable the plugin from admin.

Is any observer/event running just before uninstall started? or any other way to hide the attribute fields when uninstalling the plugin?


I do for all my products place on finance website but the setting you got in answer not working right now.