Ruslan Bazhikov
Ruslan Bazhikov

Reputation: 23

Woocommerce - sizeof(): Parameter must be an array or an object that implements Countable

I need a Solution to fix this Error. CMS Wordpress(4.4.21), plugin Woocommerce(2.1.6). PHP(7.3.6)

sizeof(): Parameter must be an array or an object that implements Countable in /var/www/u0900579/data/www/xxx/wp-content/plugins/woocommerce/includes/wc-conditional-functions.php on line 237

function is_filtered() {
        global $_chosen_attributes;

        ERROR! ------>  return apply_filters( 'woocommerce_is_filtered', ( sizeof( $_chosen_attributes ) > 0 || ( isset( $_GET['max_price'] ) && isset( $_GET['min_price'] ) ) ) );
    }
}

Upvotes: 2

Views: 1412

Answers (1)

Robin Gillitzer
Robin Gillitzer

Reputation: 1612

What is the content of $_chosen_attributes? Try to typecast the variable:

return apply_filters( 'woocommerce_is_filtered', ( sizeof( (array) $_chosen_attributes ) > 0 || ( isset( $_GET['max_price'] ) && isset( $_GET['min_price'] ) ) ) );

Upvotes: 1

Related Questions