FAQs

How do I speed up WooCommerce’s “Get total spent” query?

This is one of two ‘Power Tweaks’ which are a feature of WP-Optimize Premium.

When a customer places their first order, WooCommerce calculates the total spent by running a very slow query. This power tweak replaces this slow query with two separate and much more efficient queries.

This will be especially effective on e-commerce websites containing large amounts of customers and orders.

It uses the filter:

woocommerce_customer_get_total_spent

to calculate the total spent when the user meta:

_money_spent

is not set.

This issue has been reported to WooCommerce, but not addressed yet (See issue on Github).

Our plugins

Try TeamUpdraft’s full suite of WordPress plugins.

  • UpdraftPlus

    Back up, restore and migrate your WordPress website with UpdraftPlus

  • WP-Optimize

    Speed up and optimize your WordPress website. Cache your site, clean the database and compress images

  • UpdraftCentral

    Centrally manage all your WordPress websites’ plugins, updates, backups, users, pages and posts from one location