Gatemi Age Verification Developer Reference

The free edition applies no filters of its own. The filters below are the full edition's.

Filters — Full edition

gmav_min_age

The age one product asks for, after the plugin's rules. Return 0 for none.

Argument Type
$age int The plugin's answer
$product WC_Product The product (a variation is passed as itself; the rules use its parent)
// Restrict every product tagged "alcohol" to 21.
add_filter( 'gmav_min_age', function ( $age, $product ) {
	$id = $product->get_parent_id() ?: $product->get_id();
	return has_term( 'alcohol', 'product_tag', $id ) ? max( $age, 21 ) : $age;
}, 10, 2 );

gmav_gate_age

The age the gate on the current request asks for, or 0 for no gate. Use it to show or hide the gate on pages the scopes do not cover. It decides the gate only; purchasability follows gmav_min_age.

gmav_is_crawler

Whether the request is a search engine and so exempt.

Argument Type
$is bool The plugin's answer
$agent string The lower-cased user agent

Others

  • gmav_settings — the merged settings array.
  • gmav_modules — the boot module list.
  • gmav_license_api_url, gmav_update_cache_ttl, gmav_update_retry_ttl, gmav_sync_cache_ttl — licensing and update caching.
  • Action gmav_booted — after every module has booted; receives the container.

Storage

Where Key Edition
Option gmav_settings Both All settings
Option gmav_license Full Licence state
Product meta _gmav_mode Both verify, open, or absent
Product meta _gmav_min_age Full A product's own age
Term meta (product_cat) _gmav_min_age Full A category's own age
Order meta _gmav_age Both The age that applied
Order meta _gmav_age_label Both The wording recorded
Order meta _gmav_age_at Both UTC time, Y-m-d H:i:s

No database tables. Nothing is written on users.

gmav_ok holds the confirmed age (1–3 digits), set with wc_setcookie(). Free edition: 30 days. Full edition: remember_days days, or a session cookie when it is 0.

// Has this visitor confirmed at least 18?
$ok = isset( $_COOKIE['gmav_ok'] ) && (int) $_COOKIE['gmav_ok'] >= 18;

Posted fields

Field
gmav_confirm yes, no, or dob (full edition's date gate; while the date gate is on only dob with a date clears it — a posted yes is refused)
gmav_d, gmav_m, gmav_y Day, month and year (full edition's date gate)
gmav_confirm_age The checkout tick box, yes (full edition, classic checkout)
additional_fields[gatemi-age-verification/confirm-age] The same tick box on the Checkout block, true (full edition; WooCommerce files it as _wc_other/gatemi-age-verification/confirm-age)

The answer is caught on template_redirect at priority 5.

WooCommerce hooks used

Hook
woocommerce_is_purchasable, woocommerce_variation_is_purchasable Restricted products are not purchasable until confirmed
woocommerce_add_to_cart_validation Refuses with a notice
woocommerce_check_cart_items Blocks the cart and checkout
woocommerce_checkout_create_order Writes the record (classic checkout)
woocommerce_store_api_checkout_update_order_from_request Writes the record (Checkout block); full edition: refuses the order with gmav_age_unconfirmed when the box is needed and unticked
woocommerce_review_order_before_submit Prints the tick box (full edition)
woocommerce_checkout_process Requires the tick box (full edition)
woocommerce_register_additional_checkout_field, woocommerce_store_api_register_endpoint_data Registers the Checkout block tick box and the gatemi-age-verification cart extension data (needs_confirmation, min_age) its rules read, on init at 20 (full edition)

The head snippet

The snippet adds gmav-ok to <html> when the cookie covers the page's age. It interpolates one integer only. Free edition: an inline script on the src-less handle gmavf-gate, enqueued in the head. Full edition: printed on wp_head at priority 1.

CSS classes

Class Element
.gmav-gate The full-screen overlay (#gmav-gate, role="dialog")
.gmav-gate--declined The overlay after a "no"
.gmav-gate__panel The white panel
.gmav-gate__title, .gmav-gate__message Heading and sentence
.gmav-gate__form The answer form
.gmav-gate__button, --yes, --no The buttons
.gmav-gate__again, .gmav-gate__link Try again
.gmav-gate__field, .gmav-gate__label, .gmav-gate__input, .gmav-gate__error The date-of-birth gate (full edition)
.gmav-checkout, .gmav-checkout__input, .gmav-checkout__text The checkout tick box (full edition)
html.gmav-ok Added by the snippet; hides .gmav-gate

The stylesheet gate.css is the same in both editions and loads only on pages that ask for an age.

Shopping Cart
Scroll to Top