The free edition applies no filters or actions of its own. Everything under Filters and Actions is the full edition's.
Filters — Full edition
gmph_record
Whether a price seen on this request is written to the history.
| Argument | Type | |
|---|---|---|
$record |
bool |
true |
$product |
WC_Product |
The product or variation |
$price |
float |
The price about to be recorded |
Use it to keep a staging role or a price-check bot out of the history.
add_filter( 'gmph_record', function ( $record ) {
return $record && ! current_user_can( 'manage_woocommerce' );
} );
gmph_window
The window in days for a country, after the per-country list. Clamped to 1–365; a non-positive value falls back to 30.
| Argument | Type | |
|---|---|---|
$days |
int |
The days for that country |
$country |
string |
Two-letter country code (may be empty) |
gmph_reference
The resolved reference for a product. Return null to print no line.
| Argument | Type | |
|---|---|---|
$reference |
array |
price, days, kind (lowest or regular), currency, product_id, variation_id, anchor |
$product |
WC_Product |
The product or variation |
The array must keep price and days, or nothing is printed.
gmph_lowest_text
The sentence inside the line (already escaped, with the formatted price).
| Argument | Type | |
|---|---|---|
$text |
string |
The sentence's HTML |
$reference |
array |
As above |
gmph_retention_days
Days kept beyond the longest window before the daily prune removes a row. Default 60.
gmph_settings
The merged settings array. Must return an array.
gmph_modules, gmph_license_api_url, gmph_update_cache_ttl
The module list, the gatemi.com licensing endpoint and the update payload's cache time in seconds.
Actions — Full edition
gmph_booted
Fires once the plugin's modules have booted, with the service container.
Where the plugin hooks in (both editions)
| Hook | Priority | Purpose |
|---|---|---|
woocommerce_product_get_price |
999 | Record the price |
woocommerce_product_variation_get_price |
999 | Record a variation's price |
woocommerce_get_price_html |
50 | Append the line |
woocommerce_single_product_summary |
11 | The chart (Full edition) |
woocommerce_delete_product |
10 | Remove the product's history (deleted through WooCommerce's CRUD) |
delete_post |
10 | Remove the history of a product post deleted for good (emptying the bin); other post types are ignored |
Moving a product to the bin does not remove its history.
If your own plugin changes prices, do it through woocommerce_product_get_price at any priority below 999 and the history will record your price.
The price table
{prefix}gmph_prices — shared by both editions, schema version in the option gmph_db_version.
| Column | Type |
|---|---|
id |
bigint(20) unsigned auto-increment, primary key |
product_id |
bigint(20) unsigned — the parent for a variation |
variation_id |
bigint(20) unsigned — 0 for a simple product |
price |
decimal(18,6) |
currency |
varchar(8) |
recorded_at |
datetime, UTC |
Index product (product_id, variation_id, recorded_at). Rows are only ever inserted, never updated. Read the latest price of a product:
global $wpdb;
$price = $wpdb->get_var( $wpdb->prepare(
"SELECT price FROM {$wpdb->prefix}gmph_prices
WHERE product_id = %d AND variation_id = %d AND currency = %s
ORDER BY recorded_at DESC, id DESC LIMIT 1",
$product_id, 0, get_woocommerce_currency()
) );
Options, meta and cron
| Where | Key | Edition |
|---|---|---|
| Option | gmph_settings — enabled, wording, windows, chart |
Both (free reads enabled) |
| Option | gmph_db_version |
Both |
| Product meta | _gmph_exempt — introductory or progressive |
Full |
| Category term meta | _gmph_exempt — yes |
Full |
| Cron (daily) | gmph_prune (full), gmphf_prune (free) |
— |
| Option / cron | gmph_license, gmph_license_check |
Full |
| Object cache group | gmph (full), gmphf (free) |
— |
CSS classes
The stylesheet price-history.css is loaded in the footer only on pages where a line or chart was printed.
| Class | Element |
|---|---|
gmph-lowest |
The whole line |
gmph-lowest--regular |
Added when the reference is the regular-price fallback |
gmph-lowest-price |
The price inside the line |
gmph-chart, gmph-chart-line |
The SVG chart and its line (Full edition) |
.gmph-lowest { display: block; font-size: .85em; color: #555; }
