Stack · WooCommerce

What share of orders used a discount code? Ask the shop.

WooCommerce stores orders in WordPress tables with meta fields nobody remembers the names of. Adea knows them and asks the shop for you, even when you have your own plugins.

Free, no sign-up. Prefer a guided tour? Book 20 minutes with us →

What an answer looks like

What share of October's orders used a discount code?

Adea
  • Finding the orders table (HPOS)
  • Joining orders to coupon lines
  • Counting October

27% of orders

412 of 1,526 orders had at least one coupon. The code SUMMER20 accounted for 61% of them.

Sourceswp-content/plugins/woocommerce/src/Internal/DataStores/Orders

The code Adea read · wp-content/plugins/woocommerce/src/Internal/DataStores/Orders

wc_orders           -- orders
woocommerce_order_items
  WHERE order_item_type = 'coupon'

The query Adea ran (read-only)

SELECT count(DISTINCT o.id) FILTER (WHERE i.order_item_id IS NOT NULL) AS with_coupon
FROM wp_wc_orders o
LEFT JOIN wp_woocommerce_order_items i
  ON i.order_id = o.id AND i.order_item_type = 'coupon'
WHERE o.date_created_gmt >= '2026-10-01'

Understands the WordPress schema

wp_posts, wp_postmeta or the newer HPOS tables. Adea works out which variant your shop uses.

Numbers the owner can trust

Every answer shows which order statuses were counted. So you know whether "completed" also includes pending payments.

Without a new plugin

Nothing is installed in WordPress. Adea reads a read replica of the database.

How to connect WooCommerce

Create a MySQL user with read access. Give Adea access to the code if you have your own plugins or themes with business rules.

Read more about security →

CREATE USER 'adea_readonly'@'%' IDENTIFIED BY '…';
GRANT SELECT ON wordpress.* TO 'adea_readonly'@'%';

Frequently asked questions

Do we need our own code?

No. Without a code base Adea answers from the database. With code it also understands your own rules.

Does it work on shared hosting?

If the host allows an external read-only database user. Ask the host, or use a read replica.

Can it show revenue per customer?

Yes, as long as the tables are open to the role.