• Hi guys,

    since WP does not offer a possibility for plugins to define dependencies from other plugins, dependent plugins have to check this by themselves. So please insert a check for the class WP_Product since if you don’t (and you do not) you cause a fatal error in cases where – for whatever reason – WooCommerce itself is not active.

    Thanks for the plugin anyway!

Viewing 1 replies (of 1 total)
  • The WooCommerce documentation offers the code for this check:

    https://docs.woocommerce.com/document/create-a-plugin/

    /**
     * Check if WooCommerce is active
     **/
    if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
        // Put your plugin code here
    }

    I was able to resolve the fatal error by wrapping the provided if condition around the wcpb(); function call in wcpb.php at the bottom of the file.

    If this change can be made to the plugin that would be wonderful for future updates.

Viewing 1 replies (of 1 total)
  • The topic ‘Dependency and Fatal Error’ is closed to new replies.