Support » Plugin: Canada Post Shipping For WooCommerce » Fatal error on activation (not checking for WooCommerce network activation)

  • Resolved Patrick Johanneson

    (@pjohanneson)


    We were trying to activate the plugin on a WordPress Multisite installation with WooCommerce network-activated. The plugin wouldn’t activate, saying it was throwing a fatal error. Nothing was showing up in the error logs or any debugging, though.

    On a hunch I commented out the initial check for WooCommerce’s presence, and we were able to activate the plugin.

    Further investigation shows that the method to check for WooCommerce’ presence will only work if WooCommerce is activated on a per-site basis. I recommend a change to the code in canada-post-shipping-for-woocommerce.php from

    
    /**
     * Check if WooCommerce is active 
    **/
    if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
        exit;
    }
    

    to

    
    /**
     * Check if WooCommerce is active 
    **/
    if (
        ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) &&
        ! is_plugin_active_for_network( 'woocommerce/woocommerce.php' )
    ) {
        exit;
    }
    
    • This topic was modified 8 months, 2 weeks ago by Patrick Johanneson. Reason: Missed a backtick
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fatal error on activation (not checking for WooCommerce network activation)’ is closed to new replies.