The free edition (GMCDF_* classes) applies no filters of its own and registers no shortcode. Everything under Filters, Actions and Shortcode is the full edition's (namespace GatemiCountdown). Storage and markup are shared.
Filters — Full edition
gmcd_deadline
One campaign's resolved deadline, for one product. This is where code of your own answers for a campaign kind you added.
| Argument | Type | |
|---|---|---|
$resolved |
`array | null` |
$campaign |
array |
The campaign (see the shape below) |
$product_id |
int |
The product (the parent for a variation); 0 on the cart |
Return null, or an array without both keys, and the campaign is skipped for that product.
// No countdown on products that are out of stock.
add_filter( 'gmcd_deadline', function ( $resolved, $campaign, $product_id ) {
$product = $product_id ? wc_get_product( $product_id ) : null;
return ( $product && ! $product->is_in_stock() ) ? null : $resolved;
}, 10, 3 );
gmcd_kinds
The campaign kinds the editor offers, key => label. Add a kind here and resolve it in gmcd_deadline.
add_filter( 'gmcd_kinds', function ( $kinds ) {
$kinds['midnight'] = 'Ends at midnight tonight';
return $kinds;
} );
add_filter( 'gmcd_deadline', function ( $resolved, $campaign ) {
if ( 'midnight' !== $campaign['kind'] ) {
return $resolved;
}
$end = new DateTime( 'tomorrow', wp_timezone() );
return array( 'ends_at' => $end->getTimestamp(), 'minutes' => 0 );
}, 10, 2 );
gmcd_campaigns
The published campaigns as read (up to 100, in menu order then id).
gmcd_settings
The settings (enabled, always_days) after defaults.
Licensing and boot
gmcd_license_api_url, gmcd_update_cache_ttl, gmcd_update_retry_ttl, gmcd_sync_cache_ttl and gmcd_modules.
Actions — Full edition
gmcd_booted— after every module has booted; receives the container.
Shortcode — Full edition
[gatemi_countdown] prints the countdown for the current product, as on the product page. [gatemi_countdown product="123"] names a product. It uses the product page placement.
The post type
gmcd_campaign — not public, not queryable, no permalink. In the full edition it has an admin screen under WooCommerce → Countdowns and supports a title and page attributes; editing needs manage_woocommerce. The free edition registers it with no admin screen of its own.
Meta keys
| Key | Value |
|---|---|
_gmcd_kind |
scheduled, sale or evergreen |
_gmcd_ends_at |
UTC timestamp, 0 for none |
_gmcd_minutes |
Evergreen length in minutes (default 60, max 525600) |
_gmcd_restart |
Evergreen restart |
_gmcd_scope |
all, categories or products |
_gmcd_terms |
Category ids |
_gmcd_products |
Product ids |
_gmcd_placements |
Any of product, loop, cart |
_gmcd_headline |
Text above the clock |
_gmcd_expiry |
hide, zero or message |
_gmcd_expired_text |
The message at zero |
_gmcd_accent |
Hex colour or empty |
The free edition writes _gmcd_kind, _gmcd_ends_at, _gmcd_scope, _gmcd_placements, _gmcd_headline, _gmcd_expiry and _gmcd_expired_text.
Options
| Option | Holds |
|---|---|
gmcd_settings |
enabled (yes), always_days (no) |
gmcd_license |
Full edition licence |
Markup
<div class="gmcd gmcd--product" data-gmcd-ends="1792886400"
data-gmcd-minutes="0" data-gmcd-key="c42" data-gmcd-restart="0"
data-gmcd-expiry="hide" style="--gmcd-accent:#c00">
<p class="gmcd-headline">Sale ends in</p>
<div class="gmcd-clock" role="timer" aria-live="off">
<span class="gmcd-unit gmcd-unit--hours" data-gmcd-unit="hours">
<span class="gmcd-value">04</span><span class="gmcd-label">hrs</span>
</span>
…
</div>
<p class="gmcd-expired" hidden>This offer has ended.</p>
</div>
The free edition prints the same classes with data-gmcd-ends and data-gmcd-expiry only. An expired countdown showing its message is <div class="gmcd gmcd--expired gmcd--product"><p class="gmcd-expired">…</p></div>.
CSS classes
| Class | Element |
|---|---|
gmcd |
The countdown |
gmcd--product, gmcd--loop, gmcd--cart |
Its placement |
gmcd--expired |
At zero, showing a message |
gmcd-headline |
The headline |
gmcd-clock |
The digits |
gmcd-unit, `gmcd-unit–days |
hours |
gmcd-value, gmcd-label |
The number and its label |
gmcd-expired |
The message |
Full edition: the accent is the --gmcd-accent custom property on the countdown.
.gmcd--loop .gmcd-label { display: none; }
.gmcd-value { font-variant-numeric: tabular-nums; }
Stylesheet and script handles: gmcdf (free) and gmcd (full), enqueued in the footer only when a countdown was printed. The script's data object is gmcdfData / gmcdData (labels, days, and in the full edition cookie).
Cookie — Full edition
gmcd_seen — written by the browser for evergreen campaigns: up to 30 key:start pairs, one year, path /, SameSite=Lax, Secure on HTTPS. Never read by the server.
Cron — Full edition
gmcd_license_check — twice daily, only once a licence key is entered.
