Themeco Pro Woocommerce product categories in breadcrumbs?

Is there any documentation on getting categories included in the breadcumb trail?

There seems plenty of posts for X, but virtually nothing for PRO. I’d just like products to show up with the category in the breadcumb trail: shop home > product_cat > product

Tried the only thread I could find suggested installing the Breadcrumb NavXT plugin and that didn’t work (unless I’m missing something galringly obvious?).

1 Like

Hi There,

To achieve that, you have to setup a child theme first:

After that add this custom code under functions.php file locates in your child theme:

add_filter('x_breadcrumbs_data', 'post_parent_trail', 9999999, 2);
function post_parent_trail ($crumbs, $args) {
	if ( is_singular('product') ) {
		global $product;
		$category = get_the_terms( $product->ID, 'product_cat' );

		if ( count( $category ) > 0 ) {

			$cat_array             = array();
			$cat_array[1]['label'] = $category[0]->name;
			$cat_array[1]['url']   = get_term_link( $category[0]->term_id );

			array_splice($crumbs, 2, 0, $cat_array);
	return $crumbs;  

Hope that helps and thank you for understanding.

Thanks for this. Is there any documentation on that x_breadcrumbs_data filter? Or the location of the original function?

Hi There @sguilliard

We don’t have specific documentation for that. However, you can locate the original function under the following location.


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.