Why are the numbers an hour old, and what does Recalculate do?
Results are cached for an hour so the screen opens fast. Entering a cost clears the cache at once. Everything else that changes the figures gets the button.
The short answer
Aggregating a year of orders is real work, so the result is cached for an hour. Two things override that:
- entering a cost on a product clears the cache immediately — the figures never wait out a timer after the one action you took specifically to change them;
- the Recalculate button does it now, on demand, for everything else.
What WooCommerce actually does
WooCommerce gives plugins hooks for exactly this. Saving a cost fires
woocommerce_save_product_cogs_value, and the order-side equivalents fire when an order or an
order item’s cost is written. A plugin that listens to those knows when its cached numbers became
stale, instead of guessing on a schedule.
What no hook can tell you is that a status changed in bulk through a database import, or that somebody issued a refund in a payment gateway’s own interface. Those arrive silently, which is why the button exists.
What to do about it
Press Recalculate after:
- importing or bulk-editing orders, or changing many statuses at once;
- refunds issued outside WordPress, in a gateway dashboard;
- any moment when the report disagrees with something you just did — it costs one query and settles the question.
You should not need it after entering costs. If you do, that is worth writing to us about.
How Merchgain reports it
The cache key is built from the filters you actually applied — the date range, the view, the search — plus a version number for the calculation itself. That last part matters: a cache keyed only on the filters would keep serving results from an older version of the arithmetic after an update.
Results are cached as aggregates and single pages of a table, never as one giant serialised table. A megabyte-sized cache entry is silently rejected by some object caches, and the symptom — “the cache does nothing on my host” — is impossible to reproduce anywhere else.
Related answers
Disagrees with what you see in your shop? Write to us — every message is read. contact@merchgain.com