← KABAA Swatches
documentation

Setting up KABAA Swatches

From a fresh install to swatches on your product pages and shop cards. Every setting, its default, and what it does — plus what to check when something does not show.

Before you start

KABAA Swatches needs WordPress 6.0+, WooCommerce 8.0+ and PHP 8.0+, and a classic theme that uses WooCommerce’s standard variation form, as most classic themes do.

Install it from Plugins › Add New by searching for KABAA Swatches, or download it from WordPress.org ↗. Everything it adds lives under a new Swatches menu in your admin.

Nothing changes until you ask. Activating the plugin changes no page output. Every attribute starts as a dropdown, so installing it on a live shop is invisible until you choose a swatch type.

1. Give an attribute a swatch type

Two places do this, and they save the same value:

  • Swatches › Attributes — every attribute in one list; change several and save once. Best when setting up.
  • Products › Attributes — the same control on an attribute’s own form, when you are already creating or editing it.
Swatches › Attributes: a table of attributes, each with a Swatch type dropdown — Image, Colour, Button, Tile — and a Save swatch types button.
Swatches › Attributes. 1 Pick a type for each attribute, then 2 save them all at once.
TypeUse it forNeeds
DropdownLeaving WooCommerce aloneNothing
ColourColours, finishesA colour on each term
ImagePatterns, materials, printed designsAn image per term, or a variation image
TileOptions that change the look and the price: colours of a bag, finishes of a tapVariation images — see Tile swatches
ButtonSizes, volumes, quantitiesNothing — the term name is the swatch

This covers global attributes — the ones under Products › Attributes. An attribute typed straight into one product is a custom attribute and is set on that product instead: see Custom attributes.

Products › Attributes › Edit attribute, with the plugin's Swatch type dropdown set to Colour under Default sort order.
The same setting on an attribute’s own form, under Products › Attributes 1.

2. Give the terms their colours or images

Swatches › Terms lists the attributes that need term values, with a link to each one’s terms; Configure terms under Products › Attributes goes to the same screen. Terms are edited on WordPress’s own screen, so its search, bulk actions and quick edit all work.

Swatches › Terms: each attribute that needs values, what it needs (a colour or an image on each term), and an Edit terms button.
Swatches › Terms says what each attribute needs. 1 Edit terms opens WordPress’s own term list for it.
  • Colour attribute — each term gets a Swatch colour field. Leave it empty and that term shows as readable text while the others stay colours. Name a term after a colour (Navy, Tomato, Dark Olive Green) and an empty field fills itself as you type; a colour name typed into the field itself turns into its hex value. A colour you picked yourself is never replaced.
    Edit Color term screen for Black, with the Swatch colour picker below Description and a note that an empty colour fills itself from a colour name.
    The Swatch colour field on a colour attribute’s term 1.
  • Image attribute — each term gets a Swatch image from your media library. Leave it empty and the swatch uses the featured image of a variation with that term. With neither, the term shows as text.
    Edit Belt Image term screen, with the Swatch image field showing a thumbnail and Choose image and Remove buttons.
    The Swatch image field on an image attribute’s term 1.
  • Tile attribute — the same Swatch image field, but optional: a tile shows the variation’s own photo first and uses the term image only when no variation has one.

The colour field appears only on colour attributes and the image field only on image and tile ones, so the term screens stay clean everywhere else.

3. Custom attributes made inside a product

An attribute you create inside a product (Add new in its Attributes tab, values separated by |) has no terms, so it is configured on the product:

  1. Create the attribute, tick Used for variations, generate the variations and Update the product.
  2. Open the product’s Swatches tab (variable products only). Each custom attribute used for variations is listed.
  3. Choose a Swatch type. For Colour, each value gets a colour field, and values named after a colour fill themselves. For Image, each value gets an image.
  4. Update the product.
A product's Swatches tab: the custom attribute Colour set to Image, with a Choose image and Remove button for each value — Red, Navy, Ocean Blue.
A product’s Swatches tab: 1 the type for its own Colour attribute, and a value field for each of its values.

The same fallbacks apply as for terms, and sold-out marking works the same way. The settings belong to that product only: two products with a “Colour” custom attribute are set separately. If you rename a value, its colour or image is dropped on the next update and it shows as text until you set it again.

4. Tile swatches: photo and price

A tile is a larger swatch: the variation’s photo, with its price underneath. Use it on the attribute whose options look different and may cost different amounts, and leave the others (a style, a size) as buttons or a dropdown below it.

  1. Set the attribute’s type to Tile (photo and price) — on Swatches › Attributes for a global attribute, or in the product’s Swatches tab for a custom one.
  2. Give the variations their images in the product’s Variations tab. No image per term is needed.
  3. Optionally, set Tile width and Tile price under Swatches › Settings › Product page.
A product page for a hoodie with five tiles under Colour: each shows that colour's photo and its price, one with a sale price struck through.
Tiles on the product page 1: each colour’s own photo, with its price. The first reads a range because its price still depends on the Style chosen below.
  • Photo — the featured image of the first variation with that value. If none has one, the term’s (or custom value’s) image is used, then the name as text.
  • Price — the price of the variations with that value that match what is already chosen: one price, or a range (“21.99 – 23.99”) while another option still changes it. Sale prices show the regular price struck through. A sold-out variation’s price is ignored while one in stock matches. Prices are WooCommerce’s own, tax display included.
  • Hover — hovering a tile, or tabbing to it with the keyboard, shows its photo in the main product image; moving away puts the previous image back. A chosen tile keeps its photo. On a phone there is no hover: a tap chooses the tile.
  • Shop pages — on product cards a tile attribute shows as an image swatch, without the price: cards are too small for a price under every option.
The same product page with the pointer on the Blue tile: the main product image now shows the blue hoodie.
1 Hover or tab to a tile and 2 the main product image previews it.
Swatches › Settings › Product page with the Tile width and Tile price rows marked, and the preview showing two tiles from a T-Shirt product.
1 Tile width and 2 the price line. 3 The preview draws its tiles from one of your own products with a tile attribute.

The hover preview goes through WooCommerce’s own variation image functions, which most themes’ galleries (zoom, lightbox, slider) follow. A theme that replaces the gallery with a script of its own that ignores them shows tiles and prices, without the preview.

5. Set how swatches look

Swatches › Settings › Product page. A live preview beside the form updates as you change each setting, before you save.

SettingDefaultWhat it does
ShapeRoundRound or square.
Size36 × 36 pxWidth and height, each 16–120. Round with a different width and height gives an oval. Buttons use the height, and the width as their narrowest.
Font sizeThemeText of button swatches, and of colour or image swatches shown as their name. 10–32 px, or empty to follow the theme.
Tile width88 pxWidth of tile swatches, 48–200. The photo is square at this width, with the price under it.
Tile priceOnShows the price under each tile.
TooltipsOnShows “Attribute: Term” (e.g. “Colour: Ocean Blue”) instantly on hover and on keyboard focus.
Selected nameOnPrints the chosen term beside the attribute label.
Out of stockCross outCross out, blur, or hide.
Selected swatchAutomaticHow a chosen swatch is marked — see below.
Selection colourA mid blueUsed by whichever style is in use.
Swatches › Settings › Product page: shape, size, font size, tile width, tile price, tooltips, selected name, selected swatch, selection colour and out of stock, with the live preview on the right.
1 Width and height, 2 how a selected swatch is marked, and 3 the preview, which redraws as you change each setting.

How a selected swatch is marked

Automatic picks the style that suits each type, and is what you want unless you have a reason otherwise:

  • Colour and image swatches get a ring drawn outside the swatch. It never touches the swatch, so it stays visible on black and on white.
  • Button swatches get a fill: there is no colour to hide, so filling reads strongest.

Choosing Ring, Fill or Border instead applies that one style to every type — worth knowing before you pick Fill, which covers the colour a colour swatch exists to show. The text colour on a fill is worked out from the selection colour so it stays readable, and keyboard focus is drawn as a dashed outline further out than the ring, so a focused swatch always looks different from a selected one.

6. Swatches on shop and category pages

Variable product cards in product grids — the shop, categories, tags, search results, [products] shortcodes, related products, upsells and cross-sells — show swatches right before or after the card’s add-to-cart button. Set them in Swatches › Settings › Shop page, where the preview shows a sample card.

SettingDefaultWhat it does
Show on shop pagesOnOff removes card swatches everywhere.
AttributesAutomaticAutomatic: one attribute, the product’s first colour or image one, else its first button one. All swatch attributes: one row each. Only these: the ticked global attributes, where the product has them. Drag the list, or use its arrows, to set the row order.
PositionBefore the buttonOr after the add-to-cart button.
Add to cartOnOn cards that show every option a product varies by, the button reads Add to cart and adds the chosen variation without leaving the page.
PriceOnThe card’s price follows the options picked: one price, or the range still possible.
Most swatches5Per attribute; the rest sit behind a “+3” control that expands the row. 0 shows them all.
Size24 × 24 pxCard swatches only. However small, each swatch takes taps over at least 24 × 24 px.
Font sizeThemeCard swatches only.
Swatch spacing8 pxBetween swatches on a card. With a ring selection they stay far enough apart for the ring.
Row spacing6 pxBetween attribute rows on a card.
AlignmentFollow themeOr left, centre, right.

Shape, selection style and colour, tooltips and out-of-stock display are shared with the product page.

Swatches › Settings › Shop page: Show on shop pages, the Attributes choice with a sortable list, position, Add to cart, price, and the size and spacing settings, with a sample card preview.
1 Which attributes cards show, in what order; 2 add to cart on the card; 3 a sample card that follows the settings.

What shoppers can do on a card

  • The card image follows the choice: the photo of the first variation matching everything picked so far (reorder variations to change which).
  • Every link to the product on the card carries the choice, so the product opens with it selected. Clicking a picked swatch again unpicks it.
  • For products with up to 30 variations, options out of stock alongside the current choice are marked, and the price narrows to what the choice can still cost.
  • When the card shows every attribute the product varies by, its button reads Add to cart from the start, on products of any size. Pressed before every option is picked, the card outlines the missing rows and says what to choose (“Choose a Size”). With everything picked it adds the variation through WooCommerce’s own add to cart, so your mini cart updates as usual.
  • Cards that leave an attribute out keep Select options, which opens the product with the choice made. To give such cards an add-to-cart button, choose All swatch attributes.
A Hoodie card on the shop page with three colour swatches; Blue is chosen, and the card shows the blue hoodie.
1 Blue picked on the card: the photo follows, and so does 2 the price.

7. A different card for one product

The product’s Swatches tab has a Shop card choice: Use store setting, Hide on shop pages, or Choose attributes with any of that product’s swatch attributes, global or custom, in the order its card shows them.

The product’s choice wins: product choice, then the store setting, then Automatic. The settings screen says how many products make their own choice, and a product’s tab shows what the store setting would give it, so Use store setting is not a guess.

Below it, Show on card chooses which values the card shows. Untick the ones to leave off — they stay on the product page and can still be bought there. Untick every value of an attribute and its row disappears from the card.

A product's Swatches tab, Shop card set to Choose attributes, with Colour ticked in a sortable list and checkboxes for which colour and pack values the card shows.
1 Choose attributes, 2 tick and order them, and 3 untick values to leave off the card.

8. Out of stock

An option is marked unavailable when nothing purchasable matches it, taking into account what the shopper has already chosen. A variation on backorder counts as purchasable, because it can be bought. Choose how unavailable options look under Out of stock: crossed out, blurred, or hidden.

  • It works however many variations a product has, including past WooCommerce’s 30-variation threshold.
  • It does not depend on WooCommerce’s “Hide out of stock items from the catalog” setting. Leave that off if you want sold-out products to stay browsable.
A product's swatches with Red chosen under Color; under Size, Large is crossed out because no Red variation in Large is in stock.
Red chosen on a product with 45 variations: 1 Large is crossed out, because nothing in Red and Large can be bought.

9. For developers and unusual themes

Swatches › Settings › Advanced is only for themes that lay out cards unusually. Each field is a CSS selector; leave it empty to let the plugin find it.

FieldFindsBuilt in
Product cardThe element around one cardli.product, .wc-block-product, .product, .type-product
Card imageThe image that changes with the choiceThe first image on the card
Add-to-cart buttonThe card’s add-to-cart button.add_to_cart_button, .wp-block-button__link, .button
Card priceThe price that follows the choice.price
Swatches › Settings › Advanced: Product card, Card image, Add-to-cart button and Card price selector fields, each with its placeholder default.
Swatches › Settings › Advanced. The grey text in each field is what the plugin uses when you leave it empty.

Filters

// Cards that print no standard add-to-cart button get the swatches here instead.
add_filter( 'kabaa_swatches_card_hook', fn () => array(
    'hook'     => 'woocommerce_after_shop_loop_item',
    'priority' => 20,
) );

// The card image selector, after the Advanced setting.
add_filter( 'kabaa_swatches_card_image_selector', fn () => 'img.wp-post-image' );

// The card price selector, after the Advanced setting.
add_filter( 'kabaa_swatches_card_price_selector', fn () => '.product-card__price' );

Card swatch size on phones

Card swatches keep a 24 px touch area whatever their size, and rows wrap. A theme that wants a different size on phones can set the size variables itself:

@media (max-width: 480px) {
  .kabaa-swatches--card {
    --kabaa-swatch-width: 20px;
    --kabaa-swatch-height: 20px;
  }
}

10. Status, turning off, removing

Swatches › Status reports what a support request needs: WordPress, WooCommerce and PHP versions, the active theme, whether it overrides WooCommerce’s variable product template, the variation threshold, and how the availability cache behaves. It is read-only. If swatches are not appearing, the theme row is the first thing to read.

Swatches › Status: plugin, WordPress, WooCommerce and PHP versions, swatch counts, the variation preload threshold, availability cache, and the active theme with its variation template.
1 Variation template says whether your theme leaves WooCommerce’s variation form alone — the first thing to read when swatches don’t show.
  • Set an attribute back to Dropdown and it shows WooCommerce’s plain select. Its colours and images stay stored, so switching back restores them.
  • Deactivating restores dropdowns everywhere and keeps all configuration for when you reactivate.
  • Deleting removes only what the plugin created: its settings, the colours and images on terms, and the swatch settings saved on products. Attributes, terms, products, variations and every image in your media library are untouched.

Troubleshooting

I set a type but still see a dropdown.

Either the attribute is a custom one that has not been given a type in the product’s Swatches tab, or your theme renders its own variation form without calling WooCommerce’s dropdown function. In the second case the plugin steps aside on purpose so the product stays buyable — Swatches › Status shows whether your theme overrides the template.

Colours are not showing.

Check the attribute’s type is Colour and its terms have colour values. A term with no colour shows as text by design.

Swatches show on the product page but not on shop cards.

Check Show on shop pages is on, and that the product’s own Swatches tab is not set to Hide on shop pages. If your theme lays out cards unusually, name the card, its image, button or price under Swatches › Settings › Advanced; a theme whose cards print no add-to-cart button at all needs the kabaa_swatches_card_hook filter.

The card says “Select options” instead of “Add to cart”.

The card shows add to cart only when it shows every attribute the product varies by. Set the shop page attributes to All swatch attributes.

Still stuck? Ask in the support forum on WordPress.org ↗ and include what Swatches › Status reports.