Remove the Product Prefix and Rename WooCommerce Filter Titles
Product Color, Product Size, Product Material: when every attribute block in your shop filter starts with the same word, the filter is only printing the name WooCommerce gave the attribute. To remove the Product prefix from WooCommerce filter titles you give the block a title of your own, either one by one in the filter settings or for all attributes at once with a few lines of code. The same places control the other texts of the filter: the block titles, the first option of a drop-down, Clear All, Reset, Filter, Show more and even the names of single terms. All of them can be changed without editing plugin files.
Where each text in the filter comes from
HUSKY does not store its own name for a taxonomy. It asks WordPress for the taxonomy's plural name and prints it, unless you set a custom label. WooCommerce registers every global attribute with the plural name Product %s, so the attribute Color becomes a taxonomy called "Product Color", while its singular name stays "Color". Categories and tags work the same way: their plural names are "Product categories" and "Product tags". The table shows where every visible text comes from and where to change it.
| Text on the page | Where it comes from | Where to change it |
|---|---|---|
| Heading above the whole filter ("HUSKY Filter") | The widget title | The Title field of the widget |
| Title of a block (Product Color, Product categories) | The taxonomy name | Taxonomy custom label, or the woof_filter_title hook |
| First option of a drop-down | The same taxonomy name | The block title, or a copy of the drop-down template |
| Title of the price filter | The price filter's Title text | Additional options of Search by Price |
| In stock, On sale, Featured products | Texts of the extensions | The woof_ext_custom_title_* hooks |
| Clear All in the active filters panel | Plugin string | The woof_clear_all_text hook |
| Filter and Reset buttons, orderby label | Plugin strings and options | The Options tab, or a translation |
| Show more / Show less, mobile Open filter / Close filter | Design tab options | The Design tab |
| Name of a single term | The term itself | The woof_sort_terms_before_out hook |
Remove the Product prefix from WooCommerce filter titles
There are three ways, from the narrowest to the widest effect. Pick one; you do not need all of them.
One block at a time: Taxonomy custom label
- Open WooCommerce > Settings > Products Filter, tab Structure.
- In the row of the attribute (for example
pa_color), click the gear icon, additional options. - Type the title you want into Taxonomy custom label, for example
Color. Leave the field empty to go back to the WooCommerce name. - Click Apply in the popup, then Save changes at the bottom of the settings page.
The custom label replaces the taxonomy name everywhere the filter uses it: the block title, the first option of a drop-down, the placeholder of a multi-select and the label of the selected value in the active filters panel. This is also how you rename "Product categories" to "Categories" or "Shop by type", or give a brand taxonomy a different title. For a hierarchical drop-down the same field holds the titles of every level; the year, make and model filter guide explains that format.
All attributes at once: the woof_filter_title hook
With twenty attributes, typing a label for each one is tedious, and every new attribute needs it again. Every block title of the filter passes through the woof_filter_title hook, so one snippet can replace the "Product ..." name of every attribute with its singular name:
/*
* HUSKY: show "Color" instead of "Product Color" in attribute filter titles.
* Child theme functions.php or a code snippets plugin.
*/
add_filter('woof_filter_title', function ($title, $taxonomy_info, $index) {
if (is_object($taxonomy_info)
&& isset($taxonomy_info->name, $taxonomy_info->labels->name, $taxonomy_info->labels->singular_name)
&& 0 === strpos($taxonomy_info->name, 'pa_')
&& $title === $taxonomy_info->labels->name) {
// No custom label is set: use the attribute name without the prefix
return $taxonomy_info->labels->singular_name;
}
return $title;
}, 10, 3);
The check $title === $taxonomy_info->labels->name keeps any Taxonomy custom label you have set: the snippet only touches titles that are still the WooCommerce name. It changes nothing outside the filter. The hook also receives some button texts with an empty $taxonomy_info, which is why the snippet checks is_object() first.
Everywhere on the site: change the WooCommerce string
If you want the prefix gone in every place that shows attribute taxonomy names, including other widgets and admin screens, change the WooCommerce string itself. The prefix comes from _x( 'Product %s', 'Product Attribute', 'woocommerce' ), so a translation filter can return the name alone:
/*
* Remove the "Product" prefix from WooCommerce attribute names site-wide.
* Child theme functions.php or a code snippets plugin.
*/
add_filter('gettext_with_context', function ($translation, $text, $context, $domain) {
if ('woocommerce' === $domain && 'Product Attribute' === $context && 'Product %s' === $text) {
return '%s';
}
return $translation;
}, 10, 4);
The same result can be reached with Loco Translate by translating Product %s to %s in the WooCommerce text domain; save the file in Loco's custom location so a WooCommerce update does not overwrite it. On a site in another language the translated string (for example "Produkt %s") is what you see, but the snippet compares the original English text, so it works for any site language.
One side effect of any renaming method: each block also gets a CSS class built from its title, such as woof_container_productcolor. After renaming it becomes woof_container_color. If your custom CSS targets the old class, switch it to the slug-based class woof_container_pa_color, which never changes.
Change or hide the filter title and the widget heading
The "HUSKY Filter" text above the whole filter is not a plugin setting: it is the title of the widget. Open Appearance > Widgets (or the block widgets editor), open the HUSKY widget and change its Title field or empty it. An empty title prints nothing. A filter placed with the [woof] shortcode has no such heading at all.
To hide the title of one block, set Show title label to No in its additional options. This is common for drop-downs, where the first option already says what the drop-down is. The price filter has its own field: open the additional options of Search by Price and fill Title text; when it is empty, the price block has no title. For a drop-down price filter, Drop-down price filter text in the same popup sets its first option.
A taxonomy has one title for the whole shop. If one category needs a different title, for example "Shoe size" on the Shoes category, the per-category label FAQ covers it; the simplest code is a condition inside woof_filter_title:
add_filter('woof_filter_title', function ($title, $taxonomy_info, $index) {
if (is_object($taxonomy_info) && 'pa_size' === $taxonomy_info->name && is_product_category('shoes')) {
return 'Shoe size';
}
return $title;
}, 10, 3);
This works when the page reloads after each filter change. In AJAX mode the filter form is rebuilt by a background request where is_product_category() is false, so the title falls back to the default after the first selection.
Change the drop-down placeholder text
The first option of a taxonomy drop-down, the one that means "nothing selected", prints the same text as the block title. A custom label therefore changes both. If you want them to differ, for example the title Color and the first option Any colour, use a copy of the drop-down template. The plugin loads it through the woof_html_types_view_select hook, so the copy can live in your child theme and survives plugin updates.
- Copy
wp-content/plugins/woocommerce-products-filter/views/html_types/select.phptowp-content/themes/your-child-theme/husky/select.php. - Tell the plugin to use the copy:
/* * HUSKY: load the drop-down template from the child theme. * Child theme functions.php. */ add_filter('woof_html_types_view_select', function ($path) { $custom = get_stylesheet_directory() . '/husky/select.php'; return file_exists($custom) ? $custom : $path; }); - In the copy, find the line
<option value="0">and replace it with your own text.$tax_slugis available there, so one template can serve every drop-down:<option value="0"><?php echo esc_html( 'pa_color' === $tax_slug ? 'Any colour' : 'All' ); ?></option>
Multi-select blocks show the title as a placeholder; their template is views/html_types/mselect.php, loaded through woof_html_types_view_mselect in the same way. After a plugin update, compare your copy with the new original and carry over any changes.
Change Clear All, Reset, Filter and other built-in texts
The plugin's own texts fall into three groups.
Options. On the Options tab, Filter button text and Reset button text set the two buttons of the form; writing none into Reset button text hides that button. In the free version both fields are ignored and the default words are shown; change them with the translation snippet below. On the Design tab you will find Text for block more/less opened and Text for block more/less closed (by default Show more and Show less, used when a block has Not toggled terms count set), plus Text for mobile filter button and Text to close mobile filter.
Hooks. Clear All in the active filters panel has its own woof_clear_all_text hook, and the checkbox extensions have woof_ext_custom_title_* hooks: woof_ext_custom_title_by_instock, _by_onsales, _by_featured, _by_backorder and woof_ext_custom_title_stock_quantity.
/*
* HUSKY: rename built-in texts. Child theme functions.php or a code snippets plugin.
*/
add_filter('woof_clear_all_text', function ($text) {
return 'Remove all filters';
});
add_filter('woof_ext_custom_title_by_instock', function ($title) {
return 'Only products in stock';
});
add_filter('woof_ext_custom_title_by_onsales', function ($title) {
return 'Discounted products';
});
The Clear All text is written into a JavaScript string in double quotes, so do not use double quotes in it.
Translation. Everything else, such as the orderby, per page and price range labels of the active filters panel and the sort values like popularity, is a translatable string of the woocommerce-products-filter text domain. In a single-language shop the simplest tool is a gettext filter with a list of exact strings:
/*
* HUSKY: replace front-end strings. Child theme functions.php or a code snippets plugin.
*/
add_filter('gettext', function ($translation, $text, $domain) {
if ('woocommerce-products-filter' !== $domain || (is_admin() && ! wp_doing_ajax())) {
return $translation;
}
$texts = array(
'Filter' => 'Show products',
'Reset' => 'Start over',
'orderby' => 'Sort by',
'popularity' => 'Popularity',
'rating' => 'Rating',
);
return isset($texts[$text]) ? $texts[$text] : $translation;
}, 20, 3);
The strings must match exactly, including case: the default button text is Clear All, not "Clear all". The is_admin() condition keeps the plugin settings pages in their original wording while still covering the AJAX requests that redraw the filter. A replaced string changes everywhere the plugin prints it: Filter is also the button of the WooCommerce-style price slider and the default text of the slide-out tab. Loco Translate does the same without code. Translating the filter into several languages is a different task, covered in translating filter labels with WPML, Polylang or Loco Translate.
Rename a term only inside the filter
Sometimes a category or attribute value should read differently in the filter than on the product page, for example a long category name that breaks the sidebar layout. Every term list passes through woof_sort_terms_before_out before it is printed, for checkboxes, radio buttons, drop-downs, labels, colors and images alike:
/*
* HUSKY: show other names for some terms in the filter only.
* Child theme functions.php or a code snippets plugin.
*/
add_filter('woof_sort_terms_before_out', function ($terms, $type) {
$new_names = array(
1019 => 'Garden tools', // term ID => name shown in the filter
1697 => 'Kids (4-12)',
);
foreach ($terms as $key => $term) {
if (isset($term['term_id'], $new_names[$term['term_id']])) {
$terms[$key]['name'] = $new_names[$term['term_id']];
}
}
return $terms; // always return the whole array
}, 99, 2);
Find a term ID by hovering over the term in Products > Categories or the attribute's Configure terms screen: it is the tag_ID in the link. The hook runs for child terms too, so subcategories can be renamed the same way. The list is already sorted when priority 99 runs, so a renamed term keeps the position of its original name. Always return the full array: returning only the changed terms removes all the others from the filter.
If the new name does not appear
- Not saved. Apply in the additional options popup only fills in the form; the label is stored when you click Save changes on the settings page.
- Terms cache. If Cache terms is enabled under Advanced > Options, the filter keeps the term names it cached. A term renamed in WooCommerce shows its old name until you click clear terms cache or the auto-clean period runs out.
- Page cache. Cached pages keep the old HTML. Purge the cache of your caching plugin, server or CDN, and test in a private window.
- Snippet not running. Make sure the code is in the active (child) theme's
functions.phpor an active snippet, and that the filter name, the number of arguments and the strings are exactly as above.
If a text in your filter is not covered here, ask on the HUSKY support forum and include the exact text and where it appears.