GlimpseBI
tutorials

Build a WooCommerce revenue chart in WordPress (no code)

Abdussamad Bello
Abdussamad Bello
· 3 min read

Glimpse BI runs queries against the database your store already uses and renders the results as charts inside wp-admin. There are no CSV exports and nothing is sent to a third-party service. This guide builds a monthly revenue bar chart with the no-code builder, then shows the SQL version for anything the builder can't express on its own.

What you need

A WordPress site with WooCommerce, a few orders to chart, and the Glimpse BI plugin from the directory. Because Glimpse BI reads your live tables in place, there is nothing to import or sync — the orders you already have are the data.

One thing worth knowing before you start: Glimpse BI has no WooCommerce-specific templates. It charts any table in your database, which is what makes it flexible, but it also means you point it at the right table yourself.

Build the chart in the builder

Open Glimpse BI → Charts → Add chart, give the chart a name, and stay on the GUI tab. The builder is a handful of dropdowns, and the preview on the right re-runs as you change them.

For a monthly revenue chart, set:

  1. Chart type — Bar.
  2. Source table — your orders table. On modern WooCommerce with High-Performance Order Storage (HPOS) enabled, that's wp_wc_orders. On older stores still using the legacy layout, orders live in wp_posts as the shop_order post type.
  3. Measuresum, with the order-total column as the field (total_amount on the HPOS wp_wc_orders table).
  4. Dimension — the order date column, with the time transform set to month so each bar is one month.
  5. Filters (optional) — add a filter to scope the chart, for example order status equals wc-completed.

That's the whole chart. The builder generates the SQL for you (you can expand it to see exactly what runs), executes it against your database, and draws the bars. Filter values you enter are bound as parameters, not concatenated into the query.

When you need SQL instead

The GUI builds single-table aggregates. The moment you need something across tables — revenue by product category, say, which joins orders to items to terms — switch to the SQL tab and write the query yourself.

Every SQL chart is parsed into a syntax tree and checked before it runs. Only SELECT and WITH … SELECT statements are allowed; multi-statement queries, INTO OUTFILE, LOAD_FILE, SLEEP, and access to information_schema are all rejected at the parser level.

SELECT DATE_FORMAT(date_created_gmt, '%Y-%m') AS month,
       SUM(total_amount) AS revenue
FROM wp_wc_orders
WHERE status = 'wc-completed'
GROUP BY month
ORDER BY month

Because validation rejects anything that isn't a read-only SELECT, a SQL chart can query your store data but can never modify it.

If your store still uses the legacy order tables, query wp_posts joined to wp_postmeta on the _order_total meta key instead — same idea, different table.

Pin it to a dashboard

Save the chart, then add it to a dashboard to watch the trend over time. Results are cached with a stale-while-revalidate layer (a 15-minute TTL by default), so a dashboard several people are watching shares one query per window rather than hammering your database on every view.

Bring your WordPress data into focus.

Install the free plugin and build your first chart in minutes. Upgrade to Pro when you outgrow the caps.