What is the best way to determine if a particular module is enabled/active in Magento? I've tried using class_exists
to check if my code has been loaded and parsed by PHP but lately I've noticed its pretty unreliable (returns true
even when I delete the module's .xml configuration).
Is there a core function I can call?
Here is what you need to do: Log In via SSH/CLI to your domain and navigate to the root of your store. Run command bin/magento module:status . It will give you a list of enabled modules, where you can pick up an internal name of module you wish to remove.
Step 3: Enable/ Disable Magento 2 module --all mentions you can simultaneously enable or disable all modules. -f or --force means you obligate to enable or disable the modules regardless the dependencies. -c or --clear-static-content means clear any published static view files.
If you would like to use a build in function just use
Mage::helper('core')->isModuleEnabled(<module name>);
It is implemented in
Mage_Core_Helper_Abstract
Here's another option that is a more elegant way of finding out the status:
Mage::getConfig()->getModuleConfig('modulename')->is('active', 'true')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With