I have an extension deployed to some Magento stores. Is there any way for me to know when the shopowner uninstalls/ removes my extension?
The only way I know of is to use the
Uninstall.php file in your module's
Setup directory to do whatever it is you want to do. This same question was answered here (with example): Magento 2: Run a uninstall script when module is uninstalled via command line?
One thing that isn't mentioned in the linked answer is that you're not guaranteed to have the user execute the uninstall command to remove your package. There are several ways to remove packages in Magento, and there isn't a way to guarantee your uninstallation code will be run.