Woo Commerce provides code to check to see if WooCommerce is installed :
/**
* Check if WooCommerce is active
**/
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
// Put your plugin code here
}
If no idea where WooCommerece install then :
$all_plugins = get_plugins();
$active_plugins = get_option( "active_plugins" );
foreach ( $all_plugins as $plugin_path => $value ) {
if( basename( $plugin_path, ".php" ) == 'woocommerce') {
if( in_array( $plugin_path, $active_plugins ) ) {
return true;
}else {
return false;
}
}
}