Support » Plugin: Preloader » New update breaks sites if not Woocommerce present

  • You’ll probably get plenty of messages like this soon but nevertheless, your new update (1.0.9) makes sites return a fatal error if Woocommerce isn’t installed since it’s looking for the “is_checkout()” function which doesn’t exist in base WP.

    Regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The same thing happened to me tonight after updating a site without Woocommerce. I commented out the following code

    lines 99-107

    / Include JavaScript
    function WPTime_plugin_preloader_script(){	
    
    	if( function_exists('is_woocommerce') ){
    		//$woocommerce = is_woocommerce();
    		//$checkout = is_checkout();
    		//$cart = is_cart();
    		//$account = is_account_page();
    		//$view = is_view_order_page();

    and

    lines 150 – 155

    	if( function_exists('is_woocommerce') ){
    		//$woocommerce = is_woocommerce();
    		//$checkout = is_checkout();
    		//$cart = is_cart();
    		//$account = is_account_page();
    		//$view = is_view_order_page();
    

    Not sure why function_exists is returning true but I’ll take a closer look tomorrow.

    – Aaron

    In my case I discovered it was because the Avada theme creates its own “is_woocommerce” function that always returns false if WC isn’t present. (/Avada/includes/class-avada-init.php)

    Hi,

    i have the same problem with Avada.
    The correct way to verify if woocommerce is active is:

    if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
    //the code if woocommerce is active
    }

    Replace with this, at line 101 and 150 in the the-preloader.php file.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘New update breaks sites if not Woocommerce present’ is closed to new replies.