Gatemi Chat Button Developer Reference

Both editions share their stored options and their storefront class names, so code written against the markup works with either. The filter names differ: the free edition's filters start with gmwaf_, the full edition's with gmwa_.

Filters in both editions

gmwaf_agents / gmwa_agents

The people a page offers, in the order you listed them, after the plugin has dropped anybody switched off or without a usable number (and, in the full edition, anybody off duty when When nobody is on duty is set to hide).

Argument Type
$agents array A list of agent arrays: id, name, role, typed, number, enabled, days, from, to, and in the full edition greeting

Return anything that is not an array and the plugin keeps its own list. The free edition only ever shows the first entry.

// Offer nobody on public holidays kept in an option of your own.
add_filter( 'gmwa_agents', function ( $agents ) {
	$holidays = (array) get_option( 'myshop_holidays', array() );
	return in_array( wp_date( 'Y-m-d' ), $holidays, true ) ? array() : $agents;
} );

An empty list means no button at all.

gmwaf_chat_url / gmwa_chat_url

The finished https://wa.me/<digits>?text=… address for one button.

Argument Type
$url string The address, message already encoded by add_query_arg()
$agent array The agent the button is for
$context array The placeholder values: product, product_url, sku, page_url, site_title

The filter only runs for an agent with a usable number. Returning an empty string removes that button.

// Add a campaign marker to the message on product pages.
add_filter( 'gmwa_chat_url', function ( $url, $agent, $context ) {
	if ( '' === $context['product'] ) {
		return $url;
	}
	return add_query_arg( 'text', 'Ref web: ' . $context['sku'], $url );
}, 10, 3 );

Filters — Full edition

gmwa_settings

Filters the settings array after it is read from gmwa_settings. Use it to tune a value; keys you add are not saved.

gmwa_notify_order

Whether one automatic order update is sent.

Argument Type
$send bool true
$order WC_Order The order
$to string The status it reached, without wc-

It runs after the claim has been written to the order. Returning false leaves the claim in place, so the message is not retried the next time the order is touched.

// No WhatsApp updates for wholesale orders.
add_filter( 'gmwa_notify_order', function ( $send, $order ) {
	return $send && 'wholesale' !== $order->get_created_via();
}, 10, 2 );

gmwa_order_message

The text the Send on WhatsApp link on the order screen opens with ("Shop: order 1234 is now Processing." followed by the view-order link).

Argument Type
$message string The message
$order WC_Order The order
$status string The order's status

Automatic updates are not affected: they are WhatsApp templates, and only send the three template values.

gmwa_api_url

The Cloud API endpoint, by default https://graph.facebook.com/v21.0/<phone number id>/messages.

Licensing and boot

  • gmwa_license_api_url — the licence server's base URL.
  • gmwa_update_cache_ttl (default 12 hours), gmwa_update_retry_ttl (default 15 minutes) and gmwa_sync_cache_ttl (default 12 hours) — cache lifetimes in seconds, never below 60.
  • gmwa_modules — the list of modules booted.

Actions — Full edition

  • gmwa_booted — fires after every module has booted; receives the plugin's container.

Shortcode

[gatemi_whatsapp] prints the button wherever it is placed, wrapped in <span class="gmwa-inline">, with the away line when the person is off duty. It prints nothing while Show the chat button is off or nobody can be offered.

Full edition: [gatemi_whatsapp agent="sarah"] picks a person by id. An id is the person's name run through sanitize_title() (Sarah Jones → sarah-jones), or agent when there is no name; a duplicate gets -2 appended. An id that matches nobody falls back to the first person.

Options

Option Edition What it holds
gmwa_settings both The button and, in the full edition, order updates and the WhatsApp Business account fields
gmwa_agents both The list of people who answer
gmwa_license Full edition Licence key and state

The free edition saves only the keys on its screen and writes every other key back unchanged, including the full edition's access token.

Order meta — Full edition

Key Written when Value
_gmwa_optin The customer ticks the checkout box yes
_gmwa_optin_label Same The wording of the box as shown
_gmwa_optin_at Same The time, store timezone, Y-m-d H:i:s
_gmwa_sent Before an update is sent The statuses already claimed

Posted checkout field: gmwa_optin. Order meta is read and written through the order object, so HPOS and the legacy order store behave the same. Nothing is ever removed from an order on uninstall.

Cron — Full edition

  • gmwa_license_check — twice daily, scheduled only once a licence key has been entered.

The plugin has no other scheduled events; automatic updates are sent on the order status change.

CSS classes

Both editions print the same markup and ship the same stylesheet.

Class Element
gmwa-inline Wrapper of the product-page and shortcode button
gmwa-button Every button
gmwa-button--inline The product-page and shortcode button
gmwa-button--float The floating button
gmwa-float, gmwa-float--bottom-right, gmwa-float--bottom-left The floating container; the colour is the --gmwa-accent custom property on it
gmwa-away The away line
gmwa-panel, gmwa-agents, gmwa-agent, gmwa-agent__link Full edition: the panel of people when there are two or more
/* A squarer button on product pages. */
.gmwa-button--inline { border-radius: 4px; }

/* Move the floating button above a cookie bar. */
.gmwa-float { bottom: 80px; }

Both files are enqueued only on a page that printed a button. The free edition loads no JavaScript; the full edition's one script only closes the agent panel.

Shopping Cart
Scroll to Top