Fix admin analytics performance issue in WooCommerce 5.5.1

Fix admin analytics performance issue in WooCommerce 5.5.1 on child sites.

Snippet Type

Execute on Child Sites

Snippet

add_filter('posts_where', function ($where, WP_Query $wp_query) {
    if ($wp_query->get('low_in_stock')) {
        $wp_query->set('low_in_stock', false);
    }

    return $where;
}, 9, 3);

Reference

The issue is fixed in the current 2.4.4 of the WooCommerce Admin plugin which will be updated and included in version 5.6.0 of WooCommerce released in mid August.