WooCommerce revenue, subscriptions and refunds next to your traffic
Make a REST API key with Read permission in WooCommerce and Sumly reads every paid order, its refunds and, with WooCommerce Subscriptions, every subscription: MRR, revenue without tax, and which visit each order came from.
Connected in three steps
A read-only key, pasted once. Sumly does the rest.
-
1
In WordPress: WooCommerce → Settings → Advanced → REST API → Add key. Name it Sumly and set Permissions: Read.
-
2
Paste the store's https address, the Consumer key (ck_…) and the Consumer secret (cs_…). WooCommerce shows the secret once.
-
3
With WooCommerce Subscriptions installed, its subscriptions are read too; otherwise orders count as one-off sales.
-
4
To trace orders to visits, add the functions.php snippet shown with Sumly's WooCommerce integration: it keeps the visitor on each order as
sumly_visitor_id.
Keeps the Sumly visitor on each new order, so the order counts for the visit that brought it.
// Sumly: remember which visit an order came from.
$sumly_visitor = function ($order) {
$id = $_COOKIE['sumly_vid'] ?? '';
if (preg_match('/^[A-Za-z0-9-]{8,64}$/', $id)) {
$order->update_meta_data('sumly_visitor_id', $id);
}
};
add_action('woocommerce_checkout_create_order', $sumly_visitor); // classic checkout
add_action('woocommerce_store_api_checkout_update_order_meta', $sumly_visitor); // block checkout
Or let your coding assistant do it
Paste this into Claude Code, Cursor or Codex in your project. It fits the code to how your project is built, asks you for the dashboard steps and leaves the keys to you.
See what it says
Set up WooCommerce for Sumly in this project.
Sumly (https://sumly.dev) shows revenue next to the visits and app users it came from. The full guide is https://sumly.dev/integrations/woocommerce; read it if anything below is unclear.
Steps:
1. In WordPress: WooCommerce → Settings → Advanced → REST API → Add key. Name it Sumly and set Permissions: Read.
2. Paste the store's https address, the Consumer key (ck_…) and the Consumer secret (cs_…). WooCommerce shows the secret once.
3. With WooCommerce Subscriptions installed, its subscriptions are read too; otherwise orders count as one-off sales.
4. To trace orders to visits, add the functions.php snippet shown with Sumly's WooCommerce integration: it keeps the visitor on each order as `sumly_visitor_id`.
functions.php: Keeps the Sumly visitor on each new order, so the order counts for the visit that brought it.
```
// Sumly: remember which visit an order came from.
$sumly_visitor = function ($order) {
$id = $_COOKIE['sumly_vid'] ?? '';
if (preg_match('/^[A-Za-z0-9-]{8,64}$/', $id)) {
$order->update_meta_data('sumly_visitor_id', $id);
}
};
add_action('woocommerce_checkout_create_order', $sumly_visitor); // classic checkout
add_action('woocommerce_store_api_checkout_update_order_meta', $sumly_visitor); // block checkout
```
So each payment shows which visit it came from: Add the snippet below to your theme's functions.php (or a code snippets plugin) on a site that has the Sumly script. It keeps the visitor, the sumly_vid cookie, on each new order as meta sumly_visitor_id, at the classic and the block checkout. WooCommerce Subscriptions copies an order's meta to its subscription, so renewals count for the same visit. In the EU and UK there is a visitor only after they agree.
Keep in mind: Built from WooCommerce's REST API documentation and tested against responses shaped like it; it has not yet been tried on a live store. Tell us if a number looks off. The store needs https: a key never travels over plain http. Fees show only where the payment plugin writes them on the order; with other gateways, payments show without a fee. WooCommerce has no balance: payouts are at your payment provider.
How to work:
- Look at how this project is built first, and fit the code to its framework and its way of doing things; the examples above are a starting point, not something to paste as is.
- Steps that happen in a dashboard (Sumly, or WooCommerce's own) are mine: tell me exactly what to click, then wait for me.
- The WooCommerce key goes into Sumly (Projects and payments), not into this project: Sumly reads WooCommerce itself. Your part in the code is only carrying the visitor into checkout, as above.
- Keys the code needs belong in environment variables, never in the code or the repository. Never ask me to paste a secret key into this chat; tell me which variable to set.
- Change only what this needs, show me the changes before you commit, and tell me how to check that it works.
What you see after connecting
WooCommerce next to every other project and provider, on the same pages.
Overview
MRR, ARR, revenue per customer and paying customers, from WooCommerce Subscriptions.
Refunds
Every paid order without tax, with the buyer's name and country, the fee where the plugin wrote one, and refunds.
Metrics over time, plans by product name, customers, the outlook and a CSV export.
With the snippet in place
Revenue by source, campaign and country, and ROI for each cost.
Which visit paid
Add the snippet below to your theme's functions.php (or a code snippets plugin) on a site that has the Sumly script. It keeps the visitor, the sumly_vid cookie, on each new order as meta sumly_visitor_id, at the classic and the block checkout. WooCommerce Subscriptions copies an order's meta to its subscription, so renewals count for the same visit. In the EU and UK there is a visitor only after they agree.
How attribution works →Counts toward your plan
Nothing: payments, customers and refunds never count toward your plan. Only the page views and app screens Sumly keeps do. Plans →
The details
What Sumly reads
- Paid orders (processing, completed and later refunded), without tax, with the buyer's name and country
- Each refund, full or partial, on the day it was made
- Subscriptions and their renewal orders, when WooCommerce Subscriptions is installed
- The payment plugin's fee, where it writes one on the order (Stripe, WooPayments, PayPal Payments)
When Sumly reads WooCommerce
- Every 15 minutes. The first read takes three years of orders.
- Orders are read by the time they last changed, so a refund of an older order, or an order paid later, is picked up.
- Each refunded order's refunds are read for the day they were made.
- With WooCommerce Subscriptions, subscriptions are read whole each time.
- With the optional webhook (Order updated), Sumly reads at once when an order changes.
How WooCommerce money is counted
- Orders
- An order counts when it is processing or completed, on the day it was paid. Pending, on-hold, failed, cancelled and draft orders do not.
- Revenue
- The order total less tax. Shipping stays in, as it is money you took; discounts are already off the total.
- Monthly value
- A subscription's recurring total less tax and shipping, spread over its billing period: every 3 months counts a third each month, a year a twelfth.
- Trials
- A subscription counts from the end of its trial.
- Cancellations
- Pending cancellation leaves MRR at once, though the subscriber is paid up to its end. Cancelled and expired ones have ended.
- On hold
- A renewal failed or the store paused it: it stops counting until it is active again.
- Fees
- From the order's meta: _stripe_fee (WooCommerce Stripe Gateway), _wcpay_transaction_fee (WooPayments) or the PayPal Payments fee, when it is in the order's currency. Otherwise none, rather than a guess.
- Refunds
- Each refund on its own day, without its share of tax. A refund does not change MRR.
- Currency
- Each order in its own currency, turned into euros at the European Central Bank's rate of the day.
Good to know
- Built from WooCommerce's REST API documentation and tested against responses shaped like it; it has not yet been tried on a live store. Tell us if a number looks off.
- The store needs https: a key never travels over plain http.
- Fees show only where the payment plugin writes them on the order; with other gateways, payments show without a fee.
- WooCommerce has no balance: payouts are at your payment provider.
WooCommerce questions
Can Sumly change anything in my store?
No. A key with Read permission can only read, and Sumly never asks for more.
Do I need WooCommerce Subscriptions?
No. Without it every paid order counts as a sale and MRR stays empty. With it, subscriptions and renewals are read too.
Why do some orders show no fee?
WooCommerce itself keeps no fee. Sumly takes the one the payment plugin wrote on the order; gateways that write none show without a fee.
Does the webhook need a secret?
No. The address Sumly gives you already carries one, and the webhook only tells Sumly to read now; the order itself is read from the API with your key.
Is this tested on a real store?
Not yet. It follows WooCommerce's REST API documentation and is tested against responses shaped like it. If a number does not match your store, tell us.
Other integrations
Try it with your own projects
Sign in with Google or a code by e-mail and connect your first project. Free for one project, and 14 days of a paid plan with no card.
Start freeOr look around first: open the live demo.