Filters and actions
The filters below are applied by the full edition (Gatemi Product Compliance for WooCommerce). The free edition applies no filters of its own.
gmpc_declaration
The resolved declaration for a product, before it is shown or frozen onto an order.
apply_filters( 'gmpc_declaration', array $declaration, WC_Product $product, string $market );
$declaration— keysmanufacturer,responsible,importer,distributor,warnings(strings) anddocuments(array of attachment ids).$product— the product or variation being resolved.$market—euoruk.
The return value is merged over an empty declaration, so missing keys become empty. Values you return are not re-sanitised here; escape-safe plain text is expected. The renderer escapes on output.
// Add a fixed contact email to every responsible person that lacks one.
add_filter( 'gmpc_declaration', function ( $d, $product, $market ) {
if ( '' !== $d['responsible'] && false === strpos( $d['responsible'], '@' ) ) {
$d['responsible'] .= "nproductsafety@example.com";
}
return $d;
}, 10, 3 );
gmpc_market
The market a request declares for.
apply_filters( 'gmpc_market', string $market, string $country );
$market—euoruk, as worked out from shipping country, billing country, store base country, then the fallback setting.$country— the two-letter country used, or''.
Any value other than eu or uk is ignored.
gmpc_records
The compliance records after they are read, on every read (not cached through the filter).
apply_filters( 'gmpc_records', array $records );
Each record: id, title, enabled (yes/no), market (all/eu/uk), applies_to (all/products/categories), products (ids), categories (term ids), and the six declaration fields. Non-array entries are dropped. Records you add here are not normalised.
gmpc_settings
The merged settings array (enabled, guarantee_notice, placement, market).
apply_filters( 'gmpc_settings', array $settings );
gmpc_modules
The ordered list of module instances booted by the plugin. Entries that do not implement the plugin's module interface are dropped.
gmpc_license_api_url, gmpc_update_cache_ttl, gmpc_update_retry_ttl, gmpc_sync_cache_ttl
Licensing and update tuning: the gatemi.com licensing endpoint (for staging mirrors), how long the update payload is cached (default 12 hours, minimum 60 seconds), how soon a failed update check is retried (default 15 minutes) and the licence-sync cache (default 12 hours).
Action: gmpc_booted
Fires once the full edition has booted, with its service container.
do_action( 'gmpc_booted', $container );
Product meta
Both editions read and write the same keys on the parent product (variations read their parent's).
| Key | Type | Edition |
|---|---|---|
_gmpc_manufacturer |
string (lines) | Both |
_gmpc_responsible |
string (lines) | Both |
_gmpc_warnings |
string (lines) | Both |
_gmpc_importer |
string (lines) | Full edition |
_gmpc_distributor |
string (lines) | Full edition |
_gmpc_documents |
array of attachment ids | Full edition |
An empty value is deleted rather than stored, so "follow the record" is the absence of the key.
Reading a product's own fields (not records) works in either edition with get_post_meta():
$responsible = get_post_meta( $product_id, '_gmpc_responsible', true );
Order line meta: _gmpc_declaration
Written once onto each WC_Order_Item_Product on woocommerce_checkout_create_order_line_item (classic checkout and Store API), with the unique flag, through the item's own meta API — so it works with HPOS and the posts store alike. Not written when the line declares nothing and no guarantee text is set.
Full edition shape:
array(
'manufacturer' => string,
'responsible' => string,
'importer' => string,
'distributor' => string,
'warnings' => string,
'documents' => array( array( 'title' => string, 'url' => string ), ... ),
'guarantee' => string, // the shop's guarantee text at the time
'market' => 'eu'|'uk',
'frozen_at' => 'Y-m-d H:i:s', // UTC
)
Free edition shape: manufacturer, responsible, warnings, guarantee, frozen_at.
foreach ( $order->get_items() as $item ) {
$frozen = $item->get_meta( '_gmpc_declaration' );
if ( is_array( $frozen ) ) {
error_log( $item->get_name() . ': ' . $frozen['responsible'] );
}
}
The key starts with an underscore, so WooCommerce's default item-meta display hides it; the plugin draws it itself on woocommerce_after_order_itemmeta (admin) and woocommerce_order_item_meta_end (order-received page, My Account, emails).
Options
| Option | Contents | Edition |
|---|---|---|
gmpc_settings |
enabled, guarantee_notice, placement, market |
Shared (free writes enabled and guarantee_notice, keeps the rest) |
gmpc_records |
The records list | Full edition |
gmpc_license |
License state | Full edition |
Transient gmpc_update_payload and cron event gmpc_license_check belong to the full edition's updater.
Hooks the plugin uses
| Hook | Priority | Purpose |
|---|---|---|
woocommerce_single_product_summary |
25 | Print the declaration (storefront only) |
woocommerce_product_tabs |
30 | Add the "Product safety" tab, key gmpc_compliance (full edition, when enabled) |
woocommerce_checkout_create_order_line_item |
10 | Freeze onto order lines |
woocommerce_after_order_itemmeta |
10 | Draw on the admin order screen |
woocommerce_order_item_meta_end |
10 | Draw on customer-facing order views and emails |
woocommerce_product_data_tabs / _panels / woocommerce_process_product_meta |
— | The Compliance tab, target gmpc_compliance_panel |
CSS classes
Shared by both editions, so a shop's own CSS survives an upgrade:
gmpc-declaration, gmpc-declaration-title, gmpc-declaration-list, gmpc-declaration-label, gmpc-declaration-value, gmpc-documents, gmpc-document, gmpc-guarantee, gmpc-frozen, gmpc-frozen-list.
The stylesheet (handle gmpc in the full edition, gmpcf in the free one) is registered on every page and enqueued only where a declaration was drawn.
