SwatchKit Docs · v1.0 Support Download free

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 #

SoftwareMinimumTested up to
WordPress6.27.1
WooCommerce8.011.1
PHP7.48.4

SwatchKit is compatible with WooCommerce's High-Performance Order Storage (HPOS). It works with classic and block themes.

Installation #

From your WordPress dashboard

  1. Go to Plugins → Add New Plugin and search for SwatchKit.
  2. Click Install Now, then Activate.
  3. That's it — every variation dropdown on your store is now a swatch. Settings live under WooCommerce → Swatches.

Manual upload

  1. Download swatchkit-variation-swatches.zip from WordPress.org.
  2. Go to Plugins → Add New Plugin → Upload Plugin, choose the zip, and click Install Now.
  3. Activate the plugin.
Using another swatch 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:

  1. 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.
  2. 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.
  3. Tune the look. Open WooCommerce → Swatches. Change shape, size and stock behaviour and watch the live preview update before you save.
Tip — colours can fill themselves in.

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.

TypeShowsBest for
ColorA solid colour per termColour, finish, shade
ImageA Media Library image per termPatterns, prints, materials, fabric, wood grain
LabelThe term name as a buttonSize, capacity, length, storage
Color / Image (WooCommerce)WooCommerce's own colour or image per termStores already using WooCommerce 10.9+'s built-in type
Select (default)A label swatch when Convert every attribute dropdown is on; otherwise the normal dropdownAnything 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 #

  1. Set the attribute's type to Image under Products → Attributes.
  2. Open Configure terms, edit a term, and click Choose image under Swatch image.
  3. Pick or upload an image in the Media Library and click Use this image. The preview appears next to the button; Remove clears it.
  4. 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.

  1. Edit the product and open Product data → Advanced.
  2. In the SwatchKit panel, each variation attribute has a type and a shape dropdown.
  3. 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.

StateMeaningDefault look
AvailableAt least one in-stock variation matches.Normal
Out of stockThe combination exists but can't be bought right now.Crossed out
UnavailableNo 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 #

SettingWhat it doesDefault
Enable swatchesMaster switch. Off restores WooCommerce's dropdowns everywhere.On
Convert every attribute dropdown to swatchesAttributes still set to Select become label swatches.On
Keep as dropdownsAttributes that stay as normal dropdowns.None
Show tooltipsShows the term name on hover and keyboard focus. Press Esc to dismiss.On
Tooltip contentTerm 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 labelShows, for example, “Color: Navy”.On
Show the "Clear" linkWooCommerce's link that resets all choices. Clicking a selected swatch again also clears it.On

Style #

Shape and size

SettingWhat it doesDefault
ShapeRounded, 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 sizeText size of label swatches, 8–32 px.14 px

Borders and colours

SettingWhat it doesDefault
Border width0–8 px.1 px
Border colourBorder of unselected swatches.#E2E4E9
Selected colourRing around the selected swatch.#5B4BFF

Image swatches

SettingWhat it doesDefault
Image fitFill crops to the swatch shape; Fit shows the whole image.Fill
Image qualityWhich generated image size is loaded, from gallery thumbnail (fastest) to full size.Gallery thumbnail
Zoom image swatches on hoverA gentle zoom on hover. Always off for visitors who prefer reduced motion.On
Tooltip image sizeSize of the image in image tooltips, 48–240 px.96 px
Preview the product image on swatch hover ProSwaps the main gallery image while hovering a swatch.Off

Interactions

SettingWhat it doesDefault
Checkmark on the selected swatchBlack or white is chosen automatically to stay visible.On
Micro-interactionsShort hover and selection animations. Always off for visitors who prefer reduced motion.On

Stock #

SettingWhat it doesDefault
Out-of-stock swatchesCross out, blur, dim, hide, or leave as-is. Works at any variation count.Cross out
Unavailable swatchesDim, cross out, blur or hide.Dim
Prevent selecting unavailable swatchesOut-of-stock and unavailable swatches can't be clicked.On
Show remaining stock per swatch ProFor example “Only 3 left”.Off

Archive / Shop #

SettingWhat it doesDefault
Show swatches on shop and category pagesShows swatches on product cards in archives.Off
PlacementAfter the title, after the price, or after the button.After the price
Attributes to showWhich attributes appear on product cards.All
Add to cart from the archive ProBuy a variation without opening the product.Off
Maximum swatches shown, then "+N more" Pro0 shows all.0

Advanced #

SettingWhat it doesDefault
Do not load the SwatchKit stylesheetFor theme developers who style swatches themselves. Swatches keep working; only the styling is removed.Off
Custom CSS ProExtra CSS printed after SwatchKit's styles.Empty
Delete all SwatchKit data when the plugin is deletedRemoves 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.
Theme looks off?

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 #

  1. Keep the old plugin installed for now but deactivate it. Don't delete it — some plugins remove their data on delete.
  2. Activate SwatchKit. Your attributes, terms and variations are WooCommerce data and stay untouched.
  3. Set each attribute's type (Attribute types) and check your colours and images under Configure terms.
  4. 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-oos and data-unavailable carry the stock-behaviour settings.

CSS custom properties

Restyle swatches by redefining variables — no !important needed.

VariableControlsDefault
--swk-sizeSwatch width and height40px
--swk-radiusCorner radius6px
--swk-gapSpace between swatches8px
--swk-font-sizeLabel text size14px
--swk-border-widthBorder width1px
--swk-border-colorBorder colour#e2e4e9
--swk-selected-colorSelected ring colour#5b4bff
--swk-selected-widthSelected ring width2px
--swk-focus-colorKeyboard focus outline#5b4bff
--swk-disabled-opacityOpacity of dimmed swatches0.4
--swk-image-fitImage fit (cover or contain)cover
--swk-tooltip-imageTooltip image size96px
--swk-clear-colorThe “Clear” reset pillSame as selected colour
--swk-durationAnimation duration150ms
/* 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

FilterArgumentsUse it to
swatchkit_should_renderbool $render, WC_Product $productTurn swatches off for a product.
swatchkit_attribute_typestring $type, string $taxonomy, WC_Product $productForce color, image or label; return '' to keep the dropdown.
swatchkit_swatch_htmlstring $html, array $term, string $taxonomy, int $product_idChange one swatch's HTML.
swatchkit_swatch_classesarray $classes, array $term, string $taxonomyAdd classes to a swatch.
swatchkit_term_colorstring $hex, int $term_id, int $product_idChange a term's colour.
swatchkit_term_image_idint $id, int $term_id, int $product_idChange a term's image.
swatchkit_settingsarray $settingsOverride saved settings in code.
swatchkit_default_settingsarray $defaultsChange the defaults.
swatchkit_product_settingsarray $settings, int $product_idChange settings for one product.
swatchkit_enqueue_assetsbool $enqueueLoad the assets on a custom page (for example a quick-view page).
swatchkit_index_payloadarray $payload, int $product_idInspect or adjust a product's availability index.
swatchkit_pricing_urlstring $urlPoint the Get Pro button elsewhere (for example an affiliate link).
swatchkit_cache_suffixstring $suffixVary cached data, for example by language.

Actions

ActionArgumentsFires
swatchkit_before_swatchesstring $taxonomy, WC_Product $productBefore each swatch group.
swatchkit_after_swatchesstring $taxonomy, WC_Product $productAfter each swatch group.
swatchkit_index_rebuiltint $product_idAfter a product's availability index is rebuilt.
swatchkit_bootedPlugin $pluginOnce SwatchKit has loaded.
swatchkit_api_readyRegistry $registryWhen 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.

MemberDescription
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.versionThe 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.

RouteMethodDescription
/wp-json/swatchkit/v1/settingsGET, POSTRead or update settings. Values are validated; unknown keys are ignored.
/wp-json/swatchkit/v1/statusGETSystem status (the same data as the Tools tab).
/wp-json/swatchkit/v1/rebuild-indexPOSTClears 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 #

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.