Gatemi Cart Recovery Developer Reference

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

Filters — Full edition

gmcr_email

apply_filters( 'gmcr_email', array $email, array $cart, array $step ) — a recovery email just before it is sent. $email has to, subject, body (plain text, placeholders already replaced) and headers (an array, empty by default). Return anything that is not an array, or an empty to, to hold it back. The step is already claimed, so a held-back email is not retried.

$cart has id, token, email, first_name, user_id, cart_contents, total, currency, status, order_id, created_at, updated_at. $step has delay_minutes, subject, body and index.

// Send from a named sender and as HTML.
add_filter( 'gmcr_email', function ( $email ) {
	$email['headers'][] = 'From: Jane at Example Shop <jane@example.com>';
	$email['headers'][] = 'Content-Type: text/html; charset=UTF-8';
	$email['body']      = wpautop( make_clickable( esc_html( $email['body'] ) ) );
	return $email;
} );

gmcr_restore_url

apply_filters( 'gmcr_restore_url', string $url, array $cart ) — the link {restore_link} becomes. By default the checkout URL with ?gmcr_restore={token}. Keep the gmcr_restore argument on any URL you return — restoring runs on wp_loaded for any front-end URL that carries it.

gmcr_batch_size

apply_filters( 'gmcr_batch_size', int $size = 50 ) — how many carts one hourly run considers.

gmcr_settings, gmcr_modules, gmcr_license_api_url, gmcr_update_cache_ttl

The merged settings, the booted module list, the licensing endpoint and the update cache lifetime.

Actions — Full edition

  • gmcr_booted — do_action( 'gmcr_booted', Container $container ).

Database tables

Free edition — {prefix}gmcrf_carts: id, token (unique), email, first_name, cart_contents (JSON), total, status, order_id, sent_at (null until the one email is claimed), created_at, updated_at.

Full edition — {prefix}gmcr_carts: as above without sent_at, plus user_id and currency; and {prefix}gmcr_sends: id, cart_id, step, sent_at, with a unique key on (cart_id, step) — the claim. step holds the step's delay in minutes, not its position, so editing the sequence never resends a step.

Statuses: open, recovered (an order was placed — in the full edition, after at least one reminder), purchased (full edition: ordered before any reminder went out), lost. Times are stored in UTC. cart_contents is a list of product_id, variation_id, quantity — never a price.

Options, cron and query arguments

What Free edition Full edition
Settings option gmcrf_settings gmcr_settings
Schema version gmcrf_db_version gmcr_db_version
Hourly job gmcrf_process gmcr_process
Restore query argument gmcrf_restore gmcr_restore (and gmcrf_restore, for links the free edition sent)
Free-edition copy done — option gmcr_free_migrated (what was copied, set once)
Licence — option gmcr_license, cron gmcr_license_check

The hourly event exists only while recovery is switched on.

On its first init after installing its tables, the full edition reads {prefix}gmcrf_carts (only where gmcrf_db_version exists) and inserts its open, unexpired rows into {prefix}gmcr_carts with their tokens; a row with a sent_at also gets a {prefix}gmcr_sends row whose step is the delay of the first configured step. It never writes to the free table.

WooCommerce hooks used

Hook What happens
woocommerce_checkout_update_order_review Capture from the typed billing email
woocommerce_before_checkout_form Capture for a signed-in customer
woocommerce_checkout_order_processed Close every open cart for the billing email
woocommerce_thankyou The same, again, on the order-received page
wp_loaded Restore when the restore query argument is present

Example: skip carts under a minimum value

// Full edition only.
add_filter( 'gmcr_email', function ( $email, $cart ) {
	return ( (float) $cart['total'] < 20 ) ? false : $email;
}, 10, 2 );

Next

Shopping Cart
Scroll to Top