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.