WooCommerce E-Check payment gateway disappeared when site switched to multi-site

It’s because of this:

if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) {
    self::$instance->setup_constants();
    self::$instance->hooks();
    self::$instance->includes();
    self::$instance->load_textdomain();

    add_filter( 'woocommerce_payment_gateways', array( self::$instance, 'add_wc_gateway' ) );
}

The entire class doesn’t do anything if this condition isn’t true:

in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true )

The problem is that this if a plugin is network activated then it’s not stored in get_option( 'active_plugins' ).

To check if a plugin is network activated you need to also check get_network_option( 'active_sitewide_plugins' ) (note that “site” wide is old terminology and means network):

$site_plugins    = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
$network_plugins = get_network_option( 'active_sitewide_plugins' );

if ( in_array( 'woocommerce/woocommerce.php', $site_plugins ) || in_array( 'woocommerce/woocommerce.php', $network_plugins ) ) {

}

Or, better yet, don’t even bother. This class is only instantiated if class_exists( 'WooCommerce' ) returns true:

if ( ! class_exists( 'WooCommerce' ) ) {
    // etc.
} else { //else WooCommerce class exists
    return Woocommerce_Gateway_Green_Money::instance();
}

So checking whether WooCommerce is active inside the instance() method is entirely redundant.

Before you do anything however, if you are not the developer of this plugin then you need to ask them to fix this. If you make changes yourself and the plugin receives an update that doesn’t fix the issue, it’s just going to break again.

A stop-gap solution though, that I’ve used in the past, is to take advantage of the active_plugins filter to force fix the existing condition:

add_filter( 'active_plugins', function( $active_plugins ) {
    if ( function_exists( 'WC' ) && ! in_array( 'woocommerce/woocommerce.php', $active_plugins ) ) {
        $active_plugins[] = 'woocommerce/woocommerce.php';
    }

    return $active_plugins;
} );

That code will ensure that if WooCommerce is activated, which is determined by checking for the existence of the WC() function, then the active_plugins check will return true even if the plugin is network activated. It’s arguably a hack though, so fixing the plugin properly should be the first option.