SwatchKit documentation
SwatchKit replaces WooCommerce's variation dropdowns with colour, image and size swatches — built on native WooCommerce attributes, correct at any number of variations, with no jQuery on the storefront.
Requirements #
| Software | Minimum | Tested up to |
|---|---|---|
| WordPress | 6.2 | 7.1 |
| WooCommerce | 8.0 | 11.1 |
| PHP | 7.4 | 8.4 |
SwatchKit is compatible with WooCommerce's High-Performance Order Storage (HPOS). It works with classic and block themes.
Installation #
From your WordPress dashboard
- Go to Plugins → Add New Plugin and search for SwatchKit.
- Click Install Now, then Activate.
- That's it — every variation dropdown on your store is now a swatch. Settings live under WooCommerce → Swatches.
Manual upload
- Download
swatchkit-variation-swatches.zipfrom WordPress.org. - Go to Plugins → Add New Plugin → Upload Plugin, choose the zip, and click Install Now.
- Activate the plugin.
Deactivate it before activating SwatchKit. Two plugins replacing the same dropdown will fight over it. SwatchKit reads WooCommerce's own attribute data, so your attributes and terms stay exactly where they are. See Switching from another plugin.
Quick start #
With the defaults, every attribute becomes a button (label) swatch the moment you activate. To get colour or image swatches:
- Pick a type for the attribute. Go to Products → Attributes, click Edit on an attribute (for example Color), set Type to Color, Image or Label, and save.
- Give each term its colour or image. Click Configure terms next to the attribute and edit each term. Colours use a colour picker; images use the Media Library.
- Tune the look. Open WooCommerce → Swatches. Change shape, size and stock behaviour and watch the live preview update before you save.
Leave a colour empty and SwatchKit sets it from the term name: Navy becomes #000080, Burgundy becomes a deep red. The lookup uses a built-in table of 300+ colour names and never calls an external service.
Attribute types #
The type is set per attribute under Products → Attributes → Edit. It decides how that attribute's swatches look everywhere on the store.
| Type | Shows | Best for |
|---|---|---|
| Color | A solid colour per term | Colour, finish, shade |
| Image | A Media Library image per term | Patterns, prints, materials, fabric, wood grain |
| Label | The term name as a button | Size, capacity, length, storage |
| Color / Image (WooCommerce) | WooCommerce's own colour or image per term | Stores already using WooCommerce 10.9+'s built-in type |
| Select (default) | A label swatch when Convert every attribute dropdown is on; otherwise the normal dropdown | Anything you haven't configured yet |
Colour swatches #
Edit a term under Products → Attributes → Configure terms and set Swatch colour with the colour picker, or type a hex value such as #1e3a8a. Leave it empty to set it from the term name.
The checkmark on a selected colour swatch automatically turns black or white, depending on how light the colour is, so it stays visible on white, yellow and black swatches alike.
Image swatches #
- Set the attribute's type to Image under Products → Attributes.
- Open Configure terms, edit a term, and click Choose image under Swatch image.
- Pick or upload an image in the Media Library and click Use this image. The preview appears next to the button; Remove clears it.
- Save the term. The term list shows a thumbnail in the Swatch column so you can check every term at a glance.
Image tips
- Use square images of at least 100 × 100 px. Swatches are small, so a close crop of the pattern works better than a photo of the whole product.
- Keep Image quality on Gallery thumbnail (the default). It is the smallest generated size and loads fastest.
- Set Image fit to Fit (no crop) for logos or cut-out product shots that must not be cropped.
- Turn on image tooltips (General → Tooltip content → Image) to show a larger preview on hover. Its size is set by Tooltip image size.
- A term with no image still renders as a selectable swatch showing its name, so shoppers can buy it before you add images.
All image options are in Style → Image swatches. Image swatches are part of the free plugin.
Size / label swatches #
Label swatches show the term name as a button. They need no configuration — the term's name is the label. Control the text size with Label font size in Style. Term order follows the order you set on the attribute (drag to reorder under Configure terms).
WooCommerce's built-in Color / Image type #
WooCommerce 10.9 added its own Color / Image attribute type. If you already use it, SwatchKit reads the colours and images you set there — nothing to re-enter. On those attributes the term screen shows WooCommerce's own fields, and SwatchKit adds only the preview column, so there is one place to edit each value.
SwatchKit adds what the built-in type does not do: size/label swatches, out-of-stock handling, tooltips, shop-page swatches, classic-theme support and correct availability above 30 variations.
Per-product overrides #
Sometimes one product needs to look different: a Color attribute that should be images on a patterned product, or pill-shaped sizes on a single item.
- Edit the product and open Product data → Advanced.
- In the SwatchKit panel, each variation attribute has a type and a shape dropdown.
- Leave them on Inherit global to follow the store-wide settings, or choose a value to override just this product.
Stock & availability #
As a shopper picks options, SwatchKit marks every other swatch as available, out of stock, or unavailable — and it stays correct at any number of variations.
| State | Meaning | Default look |
|---|---|---|
| Available | At least one in-stock variation matches. | Normal |
| Out of stock | The combination exists but can't be bought right now. | Crossed out |
| Unavailable | No variation exists for the combination at all. | Dimmed and not selectable |
Choose how each state looks under Stock settings: cross out, blur, dim, hide, or (for out of stock) leave as-is. The settings page shows a small preview of each effect on its card.
Why it works above 30 variations
By default WooCommerce stops sending variation data to the page once a product has more than 30 variations. Most swatch plugins lose track of stock at that point and show everything as available. SwatchKit keeps a compact availability index for each product — a 1,200-variation product needs about 3 KB — so availability is always known, with no AJAX requests while shoppers click.
The index rebuilds automatically when you save a product or variation, when stock changes (including orders and refunds), when you edit attribute terms, and after imports. You never need to rebuild it by hand; Tools → Clear swatch cache is there if you ever want to.
Shop & category pages #
Turn on Archive / Shop → Show swatches on shop and category pages to show swatches under each variable product in the shop, category and tag archives. Shop-page swatches are free.
- Placement — after the title, after the price, or after the button.
- Attributes to show — pick one (usually colour) to keep product cards tidy.
- Every variable product on the page is loaded in a single database query, however many products the page shows.
Add to cart from the shop page and a +N more limit are Pro features.
Settings reference #
All settings are at WooCommerce → Swatches. You can also reach them from the Settings link under SwatchKit on the Plugins screen. Changes appear in the live preview before you save; press Ctrl/⌘ + S to save. If you try to leave with unsaved changes, the page asks first.
Settings marked Pro are visible but locked in the free plugin.
General #
| Setting | What it does | Default |
|---|---|---|
| Enable swatches | Master switch. Off restores WooCommerce's dropdowns everywhere. | On |
| Convert every attribute dropdown to swatches | Attributes still set to Select become label swatches. | On |
| Keep as dropdowns | Attributes that stay as normal dropdowns. | None |
| Show tooltips | Shows the term name on hover and keyboard focus. Press Esc to dismiss. | On |
| Tooltip content | Term name, Image, or Image and name. Images appear for image swatches; other swatches keep the name. | Term name |
| Show the selected term beside the attribute label | Shows, for example, “Color: Navy”. | On |
| Show the "Clear" link | WooCommerce's link that resets all choices. Clicking a selected swatch again also clears it. | On |
Style #
Shape and size
| Setting | What it does | Default |
|---|---|---|
| Shape | Rounded, square, circle or pill. | Rounded |
| Size (desktop) | Swatch size, 16–120 px. | 40 px |
| Size (mobile) | Used below 768 px wide, 16–120 px. | 36 px |
| Label font size | Text size of label swatches, 8–32 px. | 14 px |
Borders and colours
| Setting | What it does | Default |
|---|---|---|
| Border width | 0–8 px. | 1 px |
| Border colour | Border of unselected swatches. | #E2E4E9 |
| Selected colour | Ring around the selected swatch. | #5B4BFF |
Image swatches
| Setting | What it does | Default |
|---|---|---|
| Image fit | Fill crops to the swatch shape; Fit shows the whole image. | Fill |
| Image quality | Which generated image size is loaded, from gallery thumbnail (fastest) to full size. | Gallery thumbnail |
| Zoom image swatches on hover | A gentle zoom on hover. Always off for visitors who prefer reduced motion. | On |
| Tooltip image size | Size of the image in image tooltips, 48–240 px. | 96 px |
| Preview the product image on swatch hover Pro | Swaps the main gallery image while hovering a swatch. | Off |
Interactions
| Setting | What it does | Default |
|---|---|---|
| Checkmark on the selected swatch | Black or white is chosen automatically to stay visible. | On |
| Micro-interactions | Short hover and selection animations. Always off for visitors who prefer reduced motion. | On |
Stock #
| Setting | What it does | Default |
|---|---|---|
| Out-of-stock swatches | Cross out, blur, dim, hide, or leave as-is. Works at any variation count. | Cross out |
| Unavailable swatches | Dim, cross out, blur or hide. | Dim |
| Prevent selecting unavailable swatches | Out-of-stock and unavailable swatches can't be clicked. | On |
| Show remaining stock per swatch Pro | For example “Only 3 left”. | Off |
Archive / Shop #
| Setting | What it does | Default |
|---|---|---|
| Show swatches on shop and category pages | Shows swatches on product cards in archives. | Off |
| Placement | After the title, after the price, or after the button. | After the price |
| Attributes to show | Which attributes appear on product cards. | All |
| Add to cart from the archive Pro | Buy a variation without opening the product. | Off |
| Maximum swatches shown, then "+N more" Pro | 0 shows all. | 0 |
Advanced #
| Setting | What it does | Default |
|---|---|---|
| Do not load the SwatchKit stylesheet | For theme developers who style swatches themselves. Swatches keep working; only the styling is removed. | Off |
| Custom CSS Pro | Extra CSS printed after SwatchKit's styles. | Empty |
| Delete all SwatchKit data when the plugin is deleted | Removes settings and the availability index on delete. WooCommerce's own colour and image data is never deleted. | Off |
Tools #
- Clear swatch cache — empties the availability index. It rebuilds automatically, one product at a time, as pages are viewed.
- System status — versions, number of indexed products, object cache, active theme, whether WooCommerce's built-in Color/Image type is on, and any other swatch plugins that are active. Include this when you contact support.
Themes & builders #
SwatchKit never overrides WooCommerce template files. It swaps the dropdown through WooCommerce's own filter and keeps the original <select> in the page, hidden, as the source of truth. That is why it works with most themes without any theme-specific code.
- Themes: any theme that uses WooCommerce's standard variation form — classic or block. Because nothing is overridden, the theme's own layout and styles stay in charge.
- Page builders: Elementor (including the editor preview) and Bricks.
- Quick view, AJAX load-more and infinite scroll: new product forms are detected automatically — no setup.
- Translation: WPML and Polylang. Swatch data is cached per language.
Swatches are styled with CSS variables, so a few lines in Appearance → Customize → Additional CSS fix most differences. See CSS variables. If something is broken, please tell us which theme — theme fixes ship in the plugin.
Caching & performance #
- Storefront script: about 3 KB gzipped, with no jQuery or other libraries. Stylesheet: about 1.3 KB.
- Scripts and styles load only on product pages (and shop pages when shop swatches are on).
- Swatches are rendered on the server at their final size, so the page does not shift as it loads.
- Page caches (WP Rocket, LiteSpeed Cache, W3 Total Cache, Cloudflare) need no exclusions — swatch state is computed in the browser from data already in the page.
- Object caches (Redis, Memcached) are used automatically and flushed correctly when WooCommerce flushes its own cache.
Accessibility #
- Swatches are real buttons in a radio group. Tab reaches each attribute once; ← → ↑ ↓, Home and End move between swatches.
- Screen readers hear the attribute name, the term name and its state, for example “Blue (out of stock)”. State is never shown by colour alone.
- A visible focus ring that themes can't accidentally remove, plus Windows High Contrast support.
- Animations turn off for visitors who have “reduce motion” enabled.
- Right-to-left languages are supported.
Switching from another plugin #
- Keep the old plugin installed for now but deactivate it. Don't delete it — some plugins remove their data on delete.
- Activate SwatchKit. Your attributes, terms and variations are WooCommerce data and stay untouched.
- Set each attribute's type (Attribute types) and check your colours and images under Configure terms.
- When everything looks right, delete the old plugin.
Tools → System status lists any other swatch plugin that is still active.
Markup & CSS variables #
This markup is stable from 1.0.0. Changing it would be a breaking change, so it is safe to style against.
<div class="swk-swatches swk-swatches--color" role="radiogroup"
aria-labelledby="swk-label-pa_color"
data-attribute="pa_color" data-type="color"
data-oos="cross" data-unavailable="dim"
style="--swk-size:40px;--swk-radius:6px">
<button type="button" class="swk-swatch swk-swatch--color is-selected"
role="radio" aria-checked="true" tabindex="0"
data-value="red" style="--swk-swatch-color:#e02b2b">
<span class="swk-swatch__inner" aria-hidden="true"></span>
<span class="screen-reader-text">Red</span>
</button>
</div>
- Type modifiers:
swk-swatch--color,--image,--label. - State classes:
is-selected,is-out-of-stock,is-unavailable,is-hidden. data-oosanddata-unavailablecarry the stock-behaviour settings.
CSS custom properties
Restyle swatches by redefining variables — no !important needed.
| Variable | Controls | Default |
|---|---|---|
--swk-size | Swatch width and height | 40px |
--swk-radius | Corner radius | 6px |
--swk-gap | Space between swatches | 8px |
--swk-font-size | Label text size | 14px |
--swk-border-width | Border width | 1px |
--swk-border-color | Border colour | #e2e4e9 |
--swk-selected-color | Selected ring colour | #5b4bff |
--swk-selected-width | Selected ring width | 2px |
--swk-focus-color | Keyboard focus outline | #5b4bff |
--swk-disabled-opacity | Opacity of dimmed swatches | 0.4 |
--swk-image-fit | Image fit (cover or contain) | cover |
--swk-tooltip-image | Tooltip image size | 96px |
--swk-clear-color | The “Clear” reset pill | Same as selected colour |
--swk-duration | Animation duration | 150ms |
/* Bigger, fully round colour swatches with a black ring */
.swk-swatches--color {
--swk-size: 48px;
--swk-radius: 50%;
--swk-selected-color: #111;
}
Theme support #
Themes can opt out of SwatchKit's stylesheet or tooltips:
add_action( 'after_setup_theme', function () {
add_theme_support( 'swatchkit', array(
'stylesheet' => false, // the theme styles swatches itself
'tooltip' => false, // the theme has its own tooltips
) );
} );
PHP hooks #
Filters
| Filter | Arguments | Use it to |
|---|---|---|
swatchkit_should_render | bool $render, WC_Product $product | Turn swatches off for a product. |
swatchkit_attribute_type | string $type, string $taxonomy, WC_Product $product | Force color, image or label; return '' to keep the dropdown. |
swatchkit_swatch_html | string $html, array $term, string $taxonomy, int $product_id | Change one swatch's HTML. |
swatchkit_swatch_classes | array $classes, array $term, string $taxonomy | Add classes to a swatch. |
swatchkit_term_color | string $hex, int $term_id, int $product_id | Change a term's colour. |
swatchkit_term_image_id | int $id, int $term_id, int $product_id | Change a term's image. |
swatchkit_settings | array $settings | Override saved settings in code. |
swatchkit_default_settings | array $defaults | Change the defaults. |
swatchkit_product_settings | array $settings, int $product_id | Change settings for one product. |
swatchkit_enqueue_assets | bool $enqueue | Load the assets on a custom page (for example a quick-view page). |
swatchkit_index_payload | array $payload, int $product_id | Inspect or adjust a product's availability index. |
swatchkit_pricing_url | string $url | Point the Get Pro button elsewhere (for example an affiliate link). |
swatchkit_cache_suffix | string $suffix | Vary cached data, for example by language. |
Actions
| Action | Arguments | Fires |
|---|---|---|
swatchkit_before_swatches | string $taxonomy, WC_Product $product | Before each swatch group. |
swatchkit_after_swatches | string $taxonomy, WC_Product $product | After each swatch group. |
swatchkit_index_rebuilt | int $product_id | After a product's availability index is rebuilt. |
swatchkit_booted | Plugin $plugin | Once SwatchKit has loaded. |
swatchkit_api_ready | Registry $registry | When the extension API is ready. |
Examples
// Keep the dropdown for the "Engraving" attribute.
add_filter( 'swatchkit_attribute_type', function ( $type, $taxonomy ) {
return 'pa_engraving' === $taxonomy ? '' : $type;
}, 10, 2 );
// No swatches on products in the "Gift cards" category.
add_filter( 'swatchkit_should_render', function ( $render, $product ) {
return has_term( 'gift-cards', 'product_cat', $product->get_id() ) ? false : $render;
}, 10, 2 );
// Always use circles, whatever is saved.
add_filter( 'swatchkit_settings', function ( $settings ) {
$settings['shape'] = 'circle';
return $settings;
} );
JavaScript API #
The storefront script exposes a small API on window.SwatchKit.
| Member | Description |
|---|---|
SwatchKit.refresh() | Scans the page for new product forms and re-syncs existing ones. Rarely needed — new forms are detected automatically. |
SwatchKit.on( event, callback ) | Listens for mounted ({ form, productId }) or change ({ attribute, value, productId }). |
SwatchKit.version | The plugin version. |
SwatchKit.on( 'change', function ( detail ) {
console.log( detail.attribute, '→', detail.value );
} );
// After injecting product HTML yourself:
document.dispatchEvent( new CustomEvent( 'swatchkit:refresh' ) );
Because SwatchKit updates WooCommerce's hidden <select> and fires a normal change event, WooCommerce's own events (found_variation, reset_data) keep working for your code.
REST API #
All routes require the manage_woocommerce capability and a REST nonce or application password.
| Route | Method | Description |
|---|---|---|
/wp-json/swatchkit/v1/settings | GET, POST | Read or update settings. Values are validated; unknown keys are ignored. |
/wp-json/swatchkit/v1/status | GET | System status (the same data as the Tools tab). |
/wp-json/swatchkit/v1/rebuild-index | POST | Clears the availability index. |
Troubleshooting #
I still see dropdowns instead of swatches
- Check General → Enable swatches is on, and the attribute isn't listed under Keep as dropdowns.
- If the attribute's type is Select, turn on Convert every attribute dropdown to swatches, or set a type under Products → Attributes.
- Custom product attributes (typed directly on the product rather than created under Products → Attributes) become label swatches. For colour or image swatches, create the attribute under Products → Attributes instead — only global attributes have terms to hold a colour or image.
- Clear your page cache after changing settings.
Colour or image swatches show the term name instead
That term has no colour or image yet. Edit it under Products → Attributes → Configure terms. The Swatch column in the term list shows which terms are missing one.
Out-of-stock swatches look available
- Make sure the variation is actually out of stock (Manage stock with quantity 0, or stock status Out of stock).
- Check Stock → Out-of-stock swatches isn't set to Leave as-is.
- If stock was changed directly in the database or by a sync tool that bypasses WooCommerce, run Tools → Clear swatch cache.
Swatches look wrong in my theme
Try the CSS variables first. If the theme has its own swatch styling, turn it off in the theme, or use Advanced → Do not load the SwatchKit stylesheet and style the swk- classes yourself. Then let us know the theme name so we can fix it for everyone.
Two sets of swatches, or swatches that don't respond
Another swatch plugin — or a theme's built-in swatch feature — is also active. Tools → System status lists known swatch plugins. Deactivate the other one.
FAQ #
Are image swatches free?
Yes. Colour, image and size/label swatches, image tooltips, hover zoom and shop-page swatches are all in the free plugin.
Is there a variation limit?
No. Out-of-stock and unavailable handling works at any number of variations — 30, 1,200 or more.
Does it slow my store down?
No. The storefront script is about 3 KB with no dependencies, loads only where swatches appear, and makes no requests while shoppers pick options.
What happens if I deactivate SwatchKit?
Your store goes back to WooCommerce's dropdowns. Nothing breaks and no product data is lost. Settings stay in place unless you enabled Delete all SwatchKit data when the plugin is deleted and then delete the plugin.
Does it contact external servers?
No. Colour-name detection uses a built-in table. The only optional outbound connection is the opt-in usage and licensing prompt used by SwatchKit Pro.
Can I translate it?
Yes. The text domain is swatchkit-variation-swatches, and translations are managed on translate.wordpress.org.
Free vs Pro #
Everything in the free plugin stays free. Pro adds features on top; it never takes anything away.
Free Always
- Colour, image and size/label swatches
- Unlimited variations, correct availability
- Out-of-stock: cross, blur, dim or hide
- Image tooltips and hover zoom
- Shop and category page swatches
- Per-product type and shape overrides
- Live preview settings page
- Accessibility, RTL, WPML/Polylang
Pro Pro
- Dual- and multi-colour swatches
- Product image preview on swatch hover
- Remaining stock per swatch
- Add to cart from shop pages
- “+N more” limit on shop pages
- Custom CSS and style presets
- Swatches in product filters
See Pro plans from WooCommerce → Swatches → Get Pro.
Getting support #
- Free plugin: the WordPress.org support forum.
- Pro customers: priority support from your account at modinatheme.com.
To get a fast answer, include the output of WooCommerce → Swatches → Tools → System status, your theme name, and a link to the product page.
Enjoying SwatchKit? A review on WordPress.org helps other store owners find it.