How Gatemi Profit Reports Works

Three rules govern every number on the report.

The frozen-cost rule

A product's cost moves. A supplier raises a price, you re-price in January, a currency shifts. A report that works profit out from the cost on the product today shows last March a margin March never had — and because the number is always plausible, nobody notices.

So the cost is copied onto the order line when the order is made:

  1. A shopper checks out. As WooCommerce creates each order line (woocommerce_checkout_create_order_line_item), the plugin reads the product's unit cost and writes it onto the line as _gmcg_cost.
  2. A line added another way — on the admin order screen, through the REST API, by a subscription renewal — gets its cost the same way when WooCommerce saves it (woocommerce_new_order_item).
  3. Once a line has a cost, it is never written again. A second pass leaves it alone.
  4. The report reads only the cost on the line.

Which unit cost is read:

  • Full edition: the variation's own cost, else its product's.
  • Free edition: the product's cost (a variation always uses its product's).

Full edition: the extra cost per order (Every order also costs) is frozen the same way, onto the order as _gmcg_extra, when the order is placed — or, for an order created another way, when it first reaches a status that counts as a sale.

What that means for you

  • A cost you enter today applies to orders from today on.
  • Orders placed before you entered a cost stay "no cost recorded". Re-saving a product never rewrites them.
  • Changing a cost or the extra cost never changes a past report.

The honesty rule: no cost is unknown, not free

Counting a missing cost as nothing makes that line's margin 100% and the shop's profit a number that is always too high and never obviously wrong.

So a line with no cost:

  • is counted in Revenue;
  • is not counted in the margin. Profit and Margin are measured over the revenue that has a cost behind it;
  • is reported in a sentence: "N order lines have no cost recorded, worth amount."

An empty cost box and a 0 are different answers everywhere in the plugin: empty is "nobody has said", 0 is "this is free to us".

In the By product table the same rule holds: a product's profit is the revenue of its costed lines less their cost. A product none of whose lines has a cost shows Unknown — no cost set and sorts last, rather than showing its whole revenue as profit. Full edition: such rows are highlighted, and the CSV has a Lines with no cost column. Fill in the missing costs to make the breakdown cover future orders.

The money rule

Profit is measured against what the shop actually kept.

  • Revenue is each line's total — after coupons, before tax — less what was refunded on that line.
  • A refunded unit takes its cost back with it. The cost counted is the line's unit cost × (quantity − refunded quantity), because the goods came back too.
  • Tax is never revenue. It is the tax authority's money passing through.
  • Shipping is not revenue in the free edition. Full edition: with Revenue is set to The goods and what was charged for delivery, the shipping charged (less shipping refunded) is added.
  • Full edition: Other costs — the frozen extra per order — are subtracted from profit.

Worked example

An order for two mugs at 10.00 each (cost 4.00) and a teapot at 30.00 (no cost entered). One mug is refunded.

Mug Teapot
Revenue 20.00 − 10.00 = 10.00 30.00
Cost 4.00 × 1 = 4.00 unknown

Report: Revenue 40.00, Cost of goods 4.00, Profit 6.00, Margin 60% (6.00 of the 10.00 with a cost behind it), and "1 order lines have no cost recorded, worth 30.00".

Which orders are read

The report reads orders of type shop_order created between From and To (inclusive, in the store's timezone) with a status that counts as a sale — processing and completed, or Full edition your own list. Orders are read a page at a time, so a shop with tens of thousands of orders gets a report rather than an error.

The product breakdown

Each product — and each variation separately, because two colours are two shelves — is one row, most profitable first, ties in name order. The free edition lists ten and says how many more products sold; Full edition: the number you choose on screen, and every product in the CSV (the screen's cap does not apply to the download), with every cell protected against spreadsheet formulas.

The order screen — Full edition

With Show the profit on each order screen on, each order has a Profit box: revenue, cost (lines plus the extra) and profit, from the costs frozen on that order. The profit counts only the lines that have a cost, with a note when some do not; with none costed it reads Unknown — no cost set.

Shopping Cart
Scroll to Top