Gatemi Back in Stock Developer Reference

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

Filters — Full edition

gmbis_show_form

Whether the signup form is shown for one product. Applied after the plugin's own test (out of stock, purchasable, not external), and only while the enabled setting is on.

Argument Type
$show bool The plugin's answer
$product WC_Product The product
// No waitlist on products in the "discontinued" category.
add_filter( 'gmbis_show_form', function ( $show, $product ) {
	return $show && ! has_term( 'discontinued', 'product_cat', $product->get_id() );
}, 10, 2 );

The same answer decides whether the form's stylesheet and script load.

gmbis_email

Filters each back-in-stock email before wp_mail().

Argument Type
$email array to, subject, body (the unsubscribe line already appended), headers
$row array The waitlist row
$product WC_Product The product

Return an empty to or subject to cancel the send. The row has already been claimed as notified, so a cancelled email is not retried.

add_filter( 'gmbis_email', function ( $email ) {
	$email['headers'][] = 'Reply-To: shop@example.com';
	return $email;
} );

The confirmation email is not filterable.

gmbis_settings

Filters the settings array after it is read: enabled, double_opt_in, button_label, subject, body, batch.

Licensing and boot

  • gmbis_license_api_url — the licence server's base URL.
  • gmbis_update_cache_ttl (default 12 hours), gmbis_update_retry_ttl (default 15 minutes) and gmbis_sync_cache_ttl (default 12 hours) — cache lifetimes in seconds, never below 60.
  • gmbis_modules — the list of modules booted.

Actions — Full edition

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

Storage

Table {prefix}gmbis_waitlist, shared by both editions:

Column
id Primary key
product_id, variation_id The product. Signups are stored against the product page's product; variation_id is 0
email, user_id Who is waiting (user_id 0 for a guest)
status pending, confirmed or notified
token 32 hex characters, used by the confirm and unsubscribe links
created_at, confirmed_at, notified_at Site-time timestamps

Indexes: UNIQUE (product_id, email), (status, product_id) and (token). A signup is one INSERT … ON DUPLICATE KEY UPDATE; a send is claimed with UPDATE … SET status = 'notified' WHERE id = … AND status = 'confirmed' and mailed only when that statement moved the row.

Options

Option Edition
gmbis_settings Full The six settings
gmbis_db_version Full Schema version
gmbis_license Full Licence state
gmbisf_db_version Free Schema version

The full edition caches update data in the transient gmbis_update_payload.

Cron

Hook Edition
gmbis_send Full Single event per product, argument [ product_id ], one minute after a stock change
gmbisf_send Free The same
gmbis_license_check Full Twice daily, only once a licence key is entered
Full edition Free edition
Signup (WooCommerce AJAX) ?wc-ajax=gmbis_subscribe ?wc-ajax=gmbisf_subscribe
Nonce action gmbis_subscribe gmbisf_subscribe
Confirm link ?gmbis_confirm=<token> on the product page ?gmbisf_confirm=<token>
Unsubscribe link ?gmbis_unsubscribe=<token> on the home page — deletes every row for that address ?gmbisf_unsubscribe=<token> — deletes that row

The full edition also answers the free edition's gmbisf_confirm and gmbisf_unsubscribe links, so links emailed before an upgrade keep working.

The signup endpoint takes the POST fields nonce, product_id and email and answers JSON { "ok": bool, "message": string }.

Stock hooks the plugin listens to

woocommerce_product_set_stock, woocommerce_variation_set_stock, woocommerce_product_set_stock_status and woocommerce_variation_set_stock_status.

CSS classes

Full edition Free edition Element
.gmbis-form .gmbisf-form The form
.gmbis-intro .gmbisf-intro The sentence above the field
.gmbis-field .gmbisf-field The email field's label
.gmbis-button .gmbisf-button The button (also .button; the free edition adds .wp-element-button)
.gmbis-message .gmbisf-message The status line under the form
.gmbis-notice .gmbisf-notice The "on the list" and "removed" notices

The stylesheet and script load only on pages where the form is shown.

Shopping Cart
Scroll to Top