The free edition applies no filters of its own. It reads WooCommerce's woocommerce_variation_option_name filter to name a swatch, so a rename done there reaches the swatches too. Everything under Filters below is the full edition's.
Filters — Full edition
gmvs_attribute_type
The swatch type resolved for an attribute. Must return select, color, image or label; anything else is read as select.
| Argument | Type | |
|---|---|---|
$type |
string |
The stored type |
$taxonomy |
string |
The attribute taxonomy, e.g. pa_colour |
// Always show sizes as label swatches.
add_filter( 'gmvs_attribute_type', function ( $type, $taxonomy ) {
return 'pa_size' === $taxonomy ? 'label' : $type;
}, 10, 2 );
gmvs_swatch_html
The full markup for one attribute on the product page — wrapper, the original dropdown and the swatch buttons.
| Argument | Type | |
|---|---|---|
$output |
string |
The markup |
$args |
array |
The arguments WooCommerce passed to the dropdown filter (attribute, options, product, selected, …) |
$type |
string |
The swatch type |
Keep the original <select> in whatever you return; the swatches set it, and WooCommerce reads it.
gmvs_archive_limit
How many swatches a shop-loop row shows before the +N counter. Default 5, minimum 1.
| Argument | Type | |
|---|---|---|
$limit |
int |
Default 5 |
$product |
WC_Product_Variable |
The product |
$attribute |
string |
The attribute taxonomy |
gmvs_settings
The settings array after defaults are merged in: enabled, archive, tooltip, shape, size, disabled_behavior.
Other filters
| Filter | What it tunes |
|---|---|
gmvs_modules |
The module list, before registration |
gmvs_license_api_url |
The gatemi.com licence API base URL |
gmvs_update_cache_ttl |
How long an update check response is cached (seconds, min 60) |
gmvs_update_retry_ttl |
How long a failed update check waits before retrying (seconds, min 60) |
gmvs_sync_cache_ttl |
How long the licence sync result is cached (seconds, min 60) |
Actions — Full edition
| Action | Arguments | When |
|---|---|---|
gmvs_booted |
$container |
After every module has booted |
WooCommerce hooks used
| Hook | Priority | Edition | Purpose |
|---|---|---|---|
woocommerce_dropdown_variation_attribute_options_html |
20 | Both | Adds swatches beside the dropdown |
woocommerce_after_shop_loop_item |
20 | Full | Prints the archive row |
wp_enqueue_scripts |
10 | Both | Loads the files on product (and archive) pages |
{taxonomy}_add_form_fields, {taxonomy}_edit_form_fields, created_{taxonomy}, edited_{taxonomy} |
10 | Both | The term fields, for attributes set to a swatch type |
Options
| Option | Edition | Holds |
|---|---|---|
gmvsf_settings |
Free | enabled (yes/no), types (taxonomy → type) |
gmvs_settings |
Full | enabled, archive, tooltip, shape, size, disabled_behavior |
gmvs_attribute_types |
Full | Taxonomy → type |
gmvs_license |
Full | Licence state |
Transient gmvs_update_payload and cron event gmvs_license_check belong to the full edition's licence client.
Term meta (both editions)
| Key | Value |
|---|---|
gmvs_color |
Hex colour, validated with sanitize_hex_color() |
gmvs_image_id |
Attachment id |
gmvs_label |
Plain-text label |
// Set a term's colour programmatically.
update_term_meta( $term_id, 'gmvs_color', '#2e86c1' );
Markup
Product page, free edition:
<div class="gmvsf-wrap" data-gmvsf-attribute="pa_colour">
<select …>…</select>
<div class="gmvsf-swatches" role="group" aria-label="Colour">
<button type="button" class="gmvsf-swatch gmvsf-swatch--color is-selected"
data-gmvsf-value="red" aria-label="Red" aria-pressed="true">
<span class="gmvsf-chip" style="background-color:#c0392b"></span>
</button>
</div>
</div>
The full edition uses the same structure with the gmvs- prefix and data-gmvs-* attributes, adds gmvs--{shape}, gmvs--{size} and gmvs--fade-disabled / gmvs--hide-disabled to the wrapper, and data-gmvs-tooltip to each swatch when tooltips are on.
CSS classes worth styling
| Class (free / full) | Element |
|---|---|
.gmvsf-wrap / .gmvs-wrap |
Wrapper around dropdown and swatches |
.gmvsf-active / .gmvs-active |
Added by the script once wired; hides the dropdown |
.gmvsf-swatches / .gmvs-swatches |
The button group |
.gmvsf-swatch / .gmvs-swatch |
One swatch |
--color, --image, --label modifiers |
The swatch kind |
.gmvsf-chip / .gmvs-chip |
The colour, image or text inside |
.is-selected, .is-disabled |
State, set by the script |
.gmvs-archive, .gmvs-more |
Full edition: archive row and the +N counter |
The wrapper is inline-block on purpose: WooCommerce prints its "Clear" link inline straight after the select, and a block-level wrapper would push it onto a line of its own and throw the attribute label out of line.
Constants
| Constant | Edition |
|---|---|
GMVSF_VERSION, GMVSF_PLUGIN_URL |
Free |
GMVS_VERSION, GMVS_PLUGIN_URL |
Full |
The free edition stands down whenever GMVS_VERSION is defined.
