I have a WordPress site that uses woocommerce (in internal page), my URL structure for shop page as follow:
mysite/shop/
breadcrumb on woocommerce pages show only home link like :
You are here: Home
and my product page url:
Mysite/product-category/category_name/
my shop page breadcrumb show as follow:
You are here: Home
also my category page breadcrumb show as follow:
You are here: Home
I need to make it show as :
You are here: Home / shopping / category_name
I checked permalinks options but it seems OK .
I checked breadcrumb.php template file it seems that it consider that shop () page is the home page of my site.
How can I fix this , should i edit breadcrumb.php or there is an error in my settings?
Thanks in advance.
For anyone who stumbles on this in 2019, there is a much easier way to add an item after the “Home” breadcrumb, if you don’t want to change your permalinks or edit theme files. This may not be a perfect solution, but it worked for me.
The WC_Breadcrumb class filters the breadcrumbs before it returns them, and we can hook in and modify the array. The $crumbs array is just an array of [ [title, url], [title, url] ]
I was debugging this and unfortunatelly Woocommerce (ver. 2.3.8) doesn’t use any hooks to directly adjust the breadcrumbs array. So if you want to modify the breadcrumbs shown without changing the permalinks structure, best is to copy the breadcrumbs template file from plugin (
/woocommerce/templates/global/breadcrumb.php
) into your theme (/theme_name/woocommerce/global/
) and there add the code to include the link before the output loop starts. I only do it for product category, tag and detail but you can add other conditionals if you like.This can be done a lot easier. It is just necessary to change the permalinks settings accordingly – as mentioned on github at the issue 3145:
To apply this one has to go to:
And set the woocommerce permalinks settings to one of these:
If the latter is used the slug »/shop/…« has to be prepended.
There is an issue 6584:
Which for example occures if the »Custom Base« looks like this: »/shop/product/…«. There is a commit that fixed it, which is available in master, but not 2.2.8.
The slug part shop can be replaced by something else too, for example something localized.
I found out that breadcrumb code was in header.php of my courture theme folder and author of that theme didn’t write code for products or product category pages so I added
and for product category page
I commented the line that get the blog_name because I use custom page for my shop not the woocommerce default one . I don’t know if there is another way to do this but I notice that most code in this theme not really professional even in widget css it was a bad choice.