The free edition (GMCGF_* classes) applies no filters of its own. The filters below are the full edition's (namespace GatemiProfitReports). The meta keys and the option are shared.
Meta keys
| Key | On | Value |
|---|---|---|
_gmcg_cost |
Product, variation (post meta) | The unit cost. Absent = unknown |
_gmcg_cost |
Order line item (item meta) | The unit cost frozen when the line was created |
_gmcg_extra |
Order (Full edition) | The extra cost frozen on the order |
The same key on products is read by Gatemi Stock Valuation and Gatemi Stock Value.
// The frozen cost of each line on an order.
foreach ( wc_get_order( $order_id )->get_items() as $item ) {
$cost = $item->get_meta( '_gmcg_cost' ); // '' when unknown.
}
Writing a cost onto a past line, for example from your own import, is the same call the plugin makes; it never overwrites an existing value:
$item->add_meta_data( '_gmcg_cost', '4.00', true );
$item->save_meta_data();
Filters — Full edition
gmcg_unit_cost
The unit cost about to be frozen onto a line.
| Argument | Type | |
|---|---|---|
$cost |
`float | null` |
$product |
WC_Product |
The product or variation |
Return null to leave the line without a cost.
// Products in the "Dropship" category cost 70% of their price.
add_filter( 'gmcg_unit_cost', function ( $cost, $product ) {
$id = $product->get_parent_id() ?: $product->get_id();
if ( null === $cost && has_term( 'dropship', 'product_cat', $id ) ) {
return (float) $product->get_price() * 0.7;
}
return $cost;
}, 10, 2 );
gmcg_report
The finished report array, before it is shown or exported.
array(
'from' => '2026-10-01', 'to' => '2026-10-20',
'orders' => 0, 'lines' => 0,
'revenue' => 0.0, 'covered_revenue' => 0.0,
'cost' => 0.0, 'extra' => 0.0,
'profit' => 0.0, 'margin' => 0.0,
'unknown_lines' => 0, 'unknown_revenue' => 0.0,
'products' => array( /* id, name, qty, revenue, cost, profit, unknown */ ),
'products_hidden' => 0,
)
gmcg_report_batch
How many orders are read per query. Default 100.
gmcg_settings
The settings array after defaults.
Licensing and boot
gmcg_license_api_url, gmcg_update_cache_ttl, gmcg_update_retry_ttl, gmcg_sync_cache_ttl and gmcg_modules.
Actions — Full edition
gmcg_booted— after every module has booted; receives the container.
WooCommerce hooks used
| Hook | Edition | Does |
|---|---|---|
woocommerce_checkout_create_order_line_item |
both | Freezes the line cost at checkout |
woocommerce_new_order_item |
both | Freezes the line cost for lines added otherwise |
woocommerce_checkout_create_order |
Full | Freezes the extra cost |
woocommerce_order_status_changed |
Full | Freezes the extra on reaching a counted status, if not yet set |
woocommerce_product_options_pricing, woocommerce_process_product_meta |
both | The product cost field |
woocommerce_variation_options_pricing, woocommerce_save_product_variation |
Full | The variation cost field |
The option gmcg_settings
array(
'statuses' => array( 'processing', 'completed' ),
'basis' => 'goods', // 'goods' | 'goods_shipping'
'extra_kind' => 'none', // 'none' | 'flat' | 'percent'
'extra_amount' => '',
'rows' => 25, // 1–500
'products_column' => 'yes',
'orders_column' => 'yes',
)
The free edition writes only products_column and carries the rest through. gmcg_license holds the full edition's licence.
CSV — Full edition
Download CSV on WooCommerce → Profit streams profit-<from>-<to>.csv with the columns Product, Quantity, Revenue, Cost, Profit, Lines with no cost — every product sold in the range, not only the rows the By product table shows. A product with no costed line has an empty Profit cell.
Cron — Full edition
gmcg_license_check — twice daily, only once a licence key is entered.
CSS
Nothing is loaded on the storefront. Admin classes worth knowing:
| Class | Edition | Element |
|---|---|---|
gmcgf-no-cost / gmcga-no-cost |
Free / Full | "Not set" in the products list |
gmcga-row-unknown |
Full | A breakdown row with lines that have no cost |
gmcga-order-figure, gmcga-order-profit, gmcga-order-unknown |
Full | The order screen's Profit box |
