Woocommerce breadcrumb missing shop link?

How to set my breadcrumb to show:

You are here: Home/shop/category_name

when accessing:

mysite/product_category/category_name

instead of showing the default:

You are here: Home

John Rogers Asked on November 27, 2015 in WordPress.
Add Comment
1 Answer(s)
Best answer

Most probably you are experiencing this because the breadcrumb code was not added for products and products category pages. You can check that from your theme’s header.php file. If so, add the following code:

For products:

elseif (is_single() && get_post_type() == ‘product’)
{
$posts_page_id = get_option(‘page_for_posts’);
$posts_page_url = get_permalink($posts_page_id);
echo ‘<li>’;$bar = “shopping”;
if(get_option_tree(‘blog_name’, ”, false))
/*$bar=get_option_tree(‘blog_name’, ”, false);*/
echo “<a href=”.home_url().”/shopping/>$bar</a></li>”;
echo “<li>”;
the_title();
echo”</li>”;
}

For product category page:

if (is_tax())
{
$posts_page_id = get_option(‘page_for_posts’);
$posts_page_url = get_permalink($posts_page_id);
echo ‘<li>’;$bar = “Shopping”;
if(get_option_tree(‘blog_name’, ”, false))
echo “<a href=”.home_url().”/shopping/>$bar</a> > </li>” ;
echo “<li>”;
woocommerce_page_title();
echo”</li>”;
}

John Rogers Answered on November 27, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.