Gatemi Sticky Add to Cart Developer Reference

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

Filters — Full edition

gmsac_enabled

Whether the bar is shown for one product. Applied after the plugin's own checks (setting on, single product page, purchasable, in stock, not external or grouped).

Argument Type
$show bool true
$product WC_Product The product on the page
// No sticky bar on products in the "made-to-order" category.
add_filter( 'gmsac_enabled', function ( $show, $product ) {
	return $show && ! has_term( 'made-to-order', 'product_cat', $product->get_id() );
}, 10, 2 );

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

gmsac_thumbnail_size

The image size used for the bar's thumbnail.

Argument Type Default
$size string woocommerce_gallery_thumbnail

gmsac_settings

The merged settings array: enabled, position, devices, thumbnail, price, quantity, label.

Licensing and boot

  • gmsac_license_api_url — the licence server's address.
  • gmsac_update_cache_ttl, gmsac_update_retry_ttl, gmsac_sync_cache_ttl — cache lifetimes in seconds.
  • gmsac_modules — the modules booted.

Actions — Full edition

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

Options

Option Edition Keys
gmsacf_settings Free enabled, price
gmsac_settings Full enabled, position, devices, thumbnail, price, quantity, label
gmsac_license Full Licence state

No tables, post meta or order meta.

The form id

The bar's button is printed with an HTML form attribute, and the script gives the page's form.cart the same id:

Edition Id
Free gmsacf-product-form
Full gmsac-product-form

The script overwrites any id the theme had already put on the form. The id is also passed to the script as window.gmsacfSettings.formId / window.gmsacSettings.formId.

Markup and data attributes

<div class="gmsac gmsac-bottom gmsac-devices-all" data-gmsac data-gmsac-variable="1" hidden>
  <div class="gmsac-inner">
    <div class="gmsac-thumb" data-gmsac-thumb>…</div>
    <div class="gmsac-text">
      <span class="gmsac-title">…</span>
      <span class="gmsac-price" data-gmsac-price>…</span>
    </div>
    <label class="gmsac-qty"><input class="gmsac-qty-input" data-gmsac-qty type="number"></label>
    <button type="submit" form="gmsac-product-form" class="gmsac-button button alt" data-gmsac-button>Add to cart</button>
  </div>
</div>

The free edition prints the same structure with the gmsacf prefix (.gmsacf, .gmsacf-bottom, data-gmsacf, …), without the thumbnail and quantity elements, and with wp-element-button on the button. While the bar is visible it carries the is-visible class.

CSS

Classes worth styling: .gmsac / .gmsacf (the bar), -top / -bottom (position), .gmsac-devices-mobile / -desktop (full edition), -inner, -thumb, -text, -title, -price, -qty, -button.

Custom properties, set on the bar:

Property Default
--gmsac-bg #ffffff
--gmsac-fg #1e1e1e
--gmsac-border rgba(0, 0, 0, 0.12)
--gmsac-shadow 0 -2px 12px rgba(0, 0, 0, 0.08)
--gmsac-gap 12px
--gmsac-pad 10px

In the free edition the same properties are named --gmsacf-….

/* A dark bar in the store's colours, whatever the visitor's system says. */
.gmsac {
	--gmsac-bg: #102a43;
	--gmsac-fg: #ffffff;
	--gmsac-border: transparent;
}

The full edition's screen-size choice uses a 782-pixel breakpoint: .gmsac-devices-desktop is hidden below it and .gmsac-devices-mobile at and above it. The thumbnail is hidden at 480 pixels and narrower.

Shopping Cart
Scroll to Top