Wordpress - How to check if woocommerce is activated in theme

You could check to see if the 'WooCommerce' class exists, then run the code that requires WooCommerce.

<?php
if ( class_exists( 'WooCommerce' ) ) {
  // code that requires WooCommerce
} else {
  // you don't appear to have WooCommerce activated
}
?>

To check if woocommerce or anyother plguin is active, paste the following code on the template where you want to display the message.

if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
    echo 'WooCommerce is active.';
} else {
    echo 'WooCommerce is not Active.';
}

Use following code. It will work on multi site also.

include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'woocommerce/woocommerce.php') ) {
  // Do what you want in case woocommerce is installed
}