I have a simple if statement:
if (class_exists('Woocommerce')) {
echo 'yes';
} else {
echo 'no';
}
This works fine when using it in a theme file (functions.php for example). But when I'm using it on a plugin (plugins/myplugin/myplugin.php) it doesn't work at all. How can I check if the plugin exists/is-active within my plugin to enable/disable some features? Am I missing something?