The free edition applies no filters or actions of its own. Everything under Filters and Actions below is the full edition's. The storage, the order keys, the field names and the class names are the same in both editions, so code that reads them works with either.
Filters — Full edition
gmgw_offered
Whether the gift form is offered on this request. It runs after the plugin's own check (the Offer gift wrapping setting) and decides the cart form, the classic checkout form and the fee.
| Argument | Type | |
|---|---|---|
$offered |
bool |
The plugin's answer |
// No gift wrapping for orders shipping outside the United Kingdom.
add_filter( 'gmgw_offered', function ( $offered ) {
if ( ! $offered || ! function_exists( 'WC' ) || ! WC()->customer ) {
return $offered;
}
$country = WC()->customer->get_shipping_country();
return '' === $country || 'GB' === $country;
} );
gmgw_fee_amount
What the wrapping charge comes to for a cart. Applied on every recalculation, exactly like the fee itself, so an answer here cannot go stale. Return 0 to add no fee line.
| Argument | Type | |
|---|---|---|
$amount |
float |
The charge from the settings (once, or per item), already rounded to the store's decimals |
$cart |
WC_Cart |
The cart |
// Free wrapping on orders of 100 or more.
add_filter( 'gmgw_fee_amount', function ( $amount, $cart ) {
return (float) $cart->get_subtotal() >= 100 ? 0.0 : $amount;
}, 10, 2 );
gmgw_settings
The merged settings array (stored values over defaults) every time it is read. Change values here; do not add keys the plugin does not know.
| Argument | Type | |
|---|---|---|
$settings |
array |
The merged settings |
gmgw_modules
The list of module objects the plugin boots, in order. For advanced use only — removing a module removes that part of the plugin.
Licensing and updates
| Filter | Default | What it changes |
|---|---|---|
gmgw_license_api_url |
https://gatemi.com/wp-json/gatemi-license/v1 |
Where licence checks go |
gmgw_update_cache_ttl |
12 hours | How long an update answer is cached (minimum 60 seconds) |
gmgw_update_retry_ttl |
15 minutes | How long to wait after a failed update check |
gmgw_sync_cache_ttl |
12 hours | How long a shared licence roster is cached |
Actions — Full edition
gmgw_booted
Fires once the plugin has wired all its modules, with the service container as its argument.
Hooks the plugin listens on
Useful when a theme or another plugin changes WooCommerce's templates.
| WooCommerce hook | What the plugin does there |
|---|---|
woocommerce_cart_totals_before_order_total |
Prints the form on the cart page |
woocommerce_cart_updated |
Reads the cart form into the session |
woocommerce_before_order_notes |
Prints the form on the classic checkout |
woocommerce_checkout_update_order_review |
Reads the checkout form into the session |
woocommerce_cart_calculate_fees |
Adds the Gift wrapping fee, recomputed each pass |
woocommerce_checkout_create_order |
Writes the gift onto the order |
woocommerce_checkout_order_processed, woocommerce_cart_emptied |
Forgets the choice |
woocommerce_email_order_details (priority 20) |
Shows the gift in every order email |
woocommerce_order_details_after_order_table |
Shows the gift on the order-received page and in My Account |
woocommerce_store_api_checkout_update_order_from_request, woocommerce_store_api_checkout_order_processed |
The Checkout block path |
If your theme's cart-totals template drops woocommerce_cart_totals_before_order_total, the cart form will not print; the checkout and block paths are unaffected.
Storage
Settings option
gmgw_settings — one array, shared by both editions.
| Key | Default | Edition |
|---|---|---|
enabled |
yes |
both |
heading |
'' |
full |
wrap_label |
'' |
both |
fee |
0 |
both |
charge |
order (or item) |
full |
fee_label |
'' |
full |
fee_taxable |
no |
full |
tax_class |
'' |
full |
message |
yes |
both |
message_label |
'' |
full |
message_limit |
200 |
both |
The full edition's licence state is in its own option, gmgw_license.
Session keys
gmgw_wrap (yes or empty) and gmgw_message, in the WooCommerce session. They are cleared when the order is placed and when the cart is emptied.
Order meta
| Key | Value |
|---|---|
_gmgw_wrap |
yes when wrapping was chosen |
_gmgw_message |
The gift message, plain text with line breaks |
Read them through the order object, which works with HPOS and the legacy store alike:
$order = wc_get_order( $order_id );
if ( 'yes' === $order->get_meta( '_gmgw_wrap' ) ) {
$message = (string) $order->get_meta( '_gmgw_message' );
}
The charge itself is an ordinary fee line on the order, named "Gift wrapping" (full edition: your What the charge is called).
Posted field names
The cart and classic checkout form posts gmgw_wrap (value yes) and gmgw_message.
Checkout block fields
Registered through WooCommerce's Additional Checkout Fields API (WooCommerce 8.9+), location order:
gatemi-gift-wrap/wrap— checkboxgatemi-gift-wrap/message— text, only when messages are on
WooCommerce stores their raw values as _wc_other/gatemi-gift-wrap/wrap and _wc_other/gatemi-gift-wrap/message; the plugin then writes the same _gmgw_wrap and _gmgw_message keys as the classic path.
CSS classes
The storefront markup is the same in both editions.
| Class | Element |
|---|---|
.gmgw |
The whole gift box on the cart and checkout |
.gmgw-heading |
Its heading |
.gmgw-wrap |
The tick box line |
.gmgw-message |
The message field |
.gmgw-limit |
"Up to N characters." |
.gmgw-order |
The gift on emails, the order-received page and My Account |
.gmgw-order-wrap, .gmgw-order-message, .gmgw-order-text |
Its lines; .gmgw-order-text is the message itself |
The stylesheet (handle gmgw, free edition gmgwf) is registered on every page and loaded only on a page where the form was actually printed.
Uninstall
- Free edition: deletes
gmgw_settingsonly whengmgw_licensedoes not exist (the full edition has never run on the site). - Full edition: deletes
gmgw_settings,gmgw_license, thegmgw_update_payloadtransient and thegmgw_license_checkcron event. - Neither touches
_gmgw_wrap,_gmgw_messageor the fee lines on past orders.
