Have you ever noticed how the breadcrumbs look when viewing an attribute term archive in WooCommerce? It’ll be something like this:

The tricky part comes in when we try to find the source of “Product” right before color. If I look at the attributes in my dashboard, it only shows color. “Product” is not part of the title. So where is this coming from?

After digging through the code a bit, I found this function that creates the part of the breadcrumbs for taxonomies:
protected function add_crumbs_tax() {
$this_term = $GLOBALS['wp_query']->get_queried_object();
$taxonomy = get_taxonomy( $this_term->taxonomy );
$this->add_crumb( $taxonomy->labels->name );
if ( 0 !== intval( $this_term->parent ) ) {
$this->term_ancestors( $this_term->term_id, $this_term->taxonomy );
}
$this->add_crumb( single_term_title( '', false ), get_term_link( $this_term->term_id, $this_term->taxonomy ) );
}
Looking at it we don’t see “Product” in here at all, but there is a hidden reference to it. This line points us to the taxonomy label name.
$this->add_crumb( $taxonomy->labels->name );
What this tells us the “Product” is actually part of the label for this taxonomy. Indeed if we open up class-wc-post-types.php
we’ll see the attribute taxonomies registered. This line defines the label for our attributes:
/* translators: %s: attribute name */
'name' => sprintf( _x( 'Product %s', 'Product Attribute', 'woocommerce' ), $label ),
With this, we can change the text using a translation plugin like Loco Translate or Say What. You’ll want to find this string:
Product %s
and replace it with this:
%s
Here’s what this looks like with Say What.

Results
Now that we have our changes in place, we can see how this works on the front end of the site. As you can see instead of it saying “Product Color” now it simply says “Color” like we wanted.

That one was a bit tricky to find so I wanted to document it in case someone else is looking for this. If you have any questions, ask away in the comments.
Leave a Reply