How to Bulk-Enable Text Swatches in WoodMart Theme: A Step-by-Step SQL Guide

How to Bulk-Enable Text Swatches in WoodMart Theme: A Step-by-Step SQL Guide

If you manage a large WooCommerce store using the excellent WoodMart theme, you’ve likely encountered this time-consuming task: you have hundreds of product attributes, and you want to display them as text swatches instead of dropdowns. Clicking through each attribute term one by one isn’t just tedious—it’s impractical.

You’ve probably searched for a “bulk-enable” button in the theme options and come up empty. Don’t worry, you’re not alone.

At BrandaLAB, we recently faced this exact challenge for a client and found a clean, powerful solution that takes seconds, not hours. In this guide, we’ll walk you through the exact developer-level process using SQL to bulk-enable text swatches across all your desired attributes.

This guide is for developers, agencies, and technically confident store owners who are comfortable working with their site’s database via a tool like phpMyAdmin.

⚠️ Important: Your Database is Your Responsibility!

Before you proceed, let’s get the most critical step out of the way.

BACK UP YOUR DATABASE.

Seriously. A full backup is your only undo button. Running direct SQL queries is powerful, and a small typo can cause big problems. Please ensure you have a complete, downloadable backup before running any of the code below.

Step 1: The Investigation – Finding Your Swatch Settings

First, we need to play detective and see exactly how your specific WordPress installation stores the “text swatch” setting. While we know the key, the value can sometimes differ.

  1. In your WordPress dashboard, go to Products → Attributes.
  2. Select an attribute (like “Color”) and edit one of its terms (like “Blue”).
  3. Manually enable the swatch option for this single term and save it.
  4. Now, open your database tool (e.g., phpMyAdmin) and run the following query to see what you just saved.

Note: Your database prefix might not be wp_. Change wp_termmeta in the query below to match your prefix (e.g., wpoe_termmeta).

SQL

SELECT * FROM `wp_termmeta` 
WHERE `meta_key` = 'not_dropdown'
LIMIT 10;

You should see a result where the meta_key is not_dropdown and the meta_value is on. This confirms the exact data we need to use for our bulk update.

(Pro Tip: This is a great place in your blog post to add a screenshot of the phpMyAdmin results, highlighting the meta_key and meta_value columns.)

Step 2: The Two-Query Solution

To update all your attributes correctly, we need to perform two actions:

  1. UPDATE the terms that already have the not_dropdown key but with an incorrect or empty value.
  2. INSERT the not_dropdown key for all the terms that don’t have it at all.

This two-step process ensures every single term is correctly configured.

Part A: Fixing Existing Incorrect Attributes (The UPDATE Query)

This query finds all terms for a specific attribute that have the swatch key but an incorrect value and updates them.

SQL

UPDATE `wp_termmeta` AS tm
JOIN `wp_term_taxonomy` AS tt ON tm.term_id = tt.term_id
SET tm.meta_value = 'on'
WHERE 
    tt.taxonomy = 'pa_your_attribute_slug'
    AND tm.meta_key = 'not_dropdown'
    AND (tm.meta_value != 'on' OR tm.meta_value IS NULL);

Before You Run:

  • Change wp_termmeta and wp_term_taxonomy if your database prefix is different.
  • Change pa_your_attribute_slug to the attribute you want to target (e.g., pa_color for Color, pa_size for Size). You can find the slug under Products → Attributes.

Part B: Adding Swatches to All Other Attributes (The INSERT Query)

This query finds all terms for an attribute that are missing the swatch key entirely and inserts it for them. It’s designed to be safe and will not create duplicate entries.

SQL

INSERT INTO `wp_termmeta` (`term_id`, `meta_key`, `meta_value`)
SELECT 
    tt.term_id, 
    'not_dropdown', 
    'on'
FROM 
    `wp_term_taxonomy` AS tt
LEFT JOIN 
    `wp_termmeta` AS tm ON tt.term_id = tm.term_id AND tm.meta_key = 'not_dropdown'
WHERE 
    tt.taxonomy = 'pa_your_attribute_slug' AND tm.meta_id IS NULL;

Before You Run:

  • Again, check your database prefix (wp_termmeta, wp_term_taxonomy).
  • Replace pa_your_attribute_slug with the same attribute slug you used in the UPDATE query.

Step 3: Putting It All Together – A Real-World Example

Let’s say you want to enable text swatches for your “Color” (pa_color) and “Size” (pa_size) attributes. Here is your exact workflow:

  1. Take a full database backup.
  2. Run the UPDATE query for Color: Change the slug to pa_color and run it.
  3. Run the INSERT query for Color: Change the slug to pa_color and run it.
  4. Run the UPDATE query for Size: Change the slug to pa_size and run it.
  5. Run the INSERT query for Size: Change the slug to pa_size and run it.
  6. Go to your WordPress site and clear all caches (your caching plugin, server cache, etc.).
  7. Visit your product pages and admire your beautiful, consistent text swatches!

Need Help With Your WooCommerce Site?

And there you have it! With two simple queries, you’ve accomplished a task that could have taken hours of mind-numbing manual work. You’ve ensured consistency across your store and freed up your time for more important tasks.

At BrandaLAB, we thrive on these kinds of challenges. We believe that a powerful e-commerce platform should work for you, not the other way around. From custom development and performance optimization to solving complex database puzzles like this one, our team is dedicated to making WooCommerce do exactly what you need it to.

If you’re facing a complex WordPress or WooCommerce challenge and need an expert development team to back you up, we’d love to hear from you. Contact us today to discuss your project!