Skip to main content
fixed formatting
Source Link
nmr
  • 4.5k
  • 2
  • 17
  • 25

I found this useful from the woocommerceWooCommerce developer documentation.

You can simply call is_woocommerce_active()is_woocommerce_active() function within your plugin file.

Example if ( ! is_woocommerce_active() ) { add_action( 'admin_notices', 'WC_Subscriptions::woocommerce_inactive_notice' ); return; }

if ( ! is_woocommerce_active() ) 
{
    add_action( 'admin_notices', 'WC_Subscriptions::woocommerce_inactive_notice' );
    return;
}

is_woocommerce_active defined as below as per woo documentation `` /**

  • Check if WooCommerce is activated */ if ( ! function_exists( 'is_woocommerce_activated' ) ) { function is_woocommerce_activated() { if ( class_exists( 'woocommerce' ) ) { return true; } else { return false; } } } ``
/**
 * Check if WooCommerce is activated
 */
if ( ! function_exists( 'is_woocommerce_activated' ) ) {
    function is_woocommerce_activated() {
        if ( class_exists( 'woocommerce' ) ) { return true; } else { return false; }
    }
}

I found this useful from the woocommerce developer documentation.

You can simply call is_woocommerce_active() function within your plugin file.

Example if ( ! is_woocommerce_active() ) { add_action( 'admin_notices', 'WC_Subscriptions::woocommerce_inactive_notice' ); return; }

is_woocommerce_active defined as below as per woo documentation `` /**

  • Check if WooCommerce is activated */ if ( ! function_exists( 'is_woocommerce_activated' ) ) { function is_woocommerce_activated() { if ( class_exists( 'woocommerce' ) ) { return true; } else { return false; } } } ``

I found this useful from the WooCommerce developer documentation.

You can simply call is_woocommerce_active() function within your plugin file.

Example

if ( ! is_woocommerce_active() ) 
{
    add_action( 'admin_notices', 'WC_Subscriptions::woocommerce_inactive_notice' );
    return;
}

is_woocommerce_active defined as below as per woo documentation

/**
 * Check if WooCommerce is activated
 */
if ( ! function_exists( 'is_woocommerce_activated' ) ) {
    function is_woocommerce_activated() {
        if ( class_exists( 'woocommerce' ) ) { return true; } else { return false; }
    }
}
Source Link
Nilesh
  • 131
  • 2

I found this useful from the woocommerce developer documentation.

You can simply call is_woocommerce_active() function within your plugin file.

Example if ( ! is_woocommerce_active() ) { add_action( 'admin_notices', 'WC_Subscriptions::woocommerce_inactive_notice' ); return; }

is_woocommerce_active defined as below as per woo documentation `` /**

  • Check if WooCommerce is activated */ if ( ! function_exists( 'is_woocommerce_activated' ) ) { function is_woocommerce_activated() { if ( class_exists( 'woocommerce' ) ) { return true; } else { return false; } } } ``