Zum Inhalt springen

Swatch

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Swatch replaces WooCommerce’s variation <select> dropdowns with colour dots and labelled buttons on single product pages. You choose a swatch type per attribute, colour or button/label, and assign a hex colour or a custom label to each attribute term. The swatches drive WooCommerce’s own variations form, so a shopper picks a colour or size in one tap instead of opening a select menu.

Swatch does not reimplement WooCommerce’s variation logic, it filters the dropdown markup, keeps the original <select> in the page (visually hidden), and mirrors swatch clicks onto it. Price, stock and the add-to-cart button update exactly as they do with the stock dropdown, and out-of-combination swatches are disabled automatically as WooCommerce recalculates. The free edition is the full GPL product: self-contained, no external service, no account.

  • Two swatch types, round colour dots, or button/label pills showing the term name.
  • Per-attribute type chosen on the global attribute screen (Products → Attributes); a Colour attribute can use dots while Size uses pills.
  • Per-term colour and label, a hex colour (sanitised with sanitize_hex_color) and an optional short label, both stored as term meta.
  • Drives the native variations form, vanilla JavaScript hooking WooCommerce’s own variation events; no jQuery added by Swatch.
  • Keyboard operable, each attribute is a radiogroup; arrow keys, Home/End and Space/Enter all work, with visible focus rings.
  • Graceful fallback, an unconfigured attribute, or a colour attribute with no colours set, keeps the standard dropdown. Nothing ever breaks.
  • Settings page under WooCommerce, a master enable/disable toggle and the default swatch type. That is the whole settings screen.

For each variation attribute, Swatch resolves a type (the attribute’s own, or the store default), reads each term’s colour or label, and renders a radiogroup of role="radio" buttons after the hidden <select>. Clicking or keying a swatch sets the select’s value and fires its change event; WooCommerce does the rest. There is no separate variation engine to keep in sync.

  • Free on WordPress.org, colour and button/label swatches, per-attribute type, per-term colour/label, the settings page, and the swatch/swatch_group_html filter for add-ons.
  • Swatch Pro (Freemius) adds image swatches today, rendered through that same filter; per-variation image galleries and archive/loop swatches are on the roadmap. See Swatch Pro.