You likely need to replace the WooCommerce breadcrumbs with the Yoast breadcrumbs. We have two examples of how to do this here.
If these examples do not work, unfortunately, you’ll need to reach back out to the theme developer for assistance.
Thanks @amboutwe!
Does this which file does thos PHp code need to be placed in?
Thanks 🙂
The most common place to place the code is your theme’s functions.php file. Some theme files may be overwritten when your theme updates so you may want to ask your theme developer if they have a custom functions file that doesn’t get replaced upon upgrade.
Hi @amboutwe
I asked my theme developer and he said this…
‘WooCommerce breadcrumbs included in several WooCommerce template files, you need to add your code in different files and I does not have full list of files, because we never changed WooCommerce breadcrumbs before.
For example you can see breadcrumbs defenitions in theme files:
/woocommerce/archive-product.php (for categories)
/woocommerce/single-product.php (for product page)
And maybe some other.’
Do you know which files Woocommerce files have breadcrumbs in that need replacing with Yoast breadcrumbs?
Thanks very much!
The code (provided earlier) hooks into WooCommerce to automatically override each file that would typically output the breadcrumbs. Therefore, you would not need to know all of the file locations.
Did the code not work for your theme?
Thanks @amboutwe
It appears to not work. I have a non-wootheme, so i added the relevant code to functions.php in child theme folder.
The only change it appeared to make is add a page trail to the product pages above the main product title (e.g. Home >> Products >> Product Title)
I have checked product pages where I have set default product categories, and adding this code has not made the default category show on the front end.
Thanks
Hi @amboutwe,
I’m yet to receive a reply from you on this question.
Have you had a chance to respond yet?
Thanks
Is Category selected here:
Admin > SEO > Advanced > Breadcrumbs > Taxonomy to show in breadcrumbs for post types > Products
Hi Amboutwe,
No it was not. I have just enabled it but it has made no change to the problem.
Please advise.
Thanks,
Miles
Hi @amboutwe
This error is still happening.
Can you please advise me further than your last point?
Thanks,
Miles
What breadcrumb separator is selected here:
Admin > SEO > Advanced > Breadcrumbs
Does this match the separator you see on product categories?
Yes – Does changing this separator to something else, also change what you see on the page?
No – The Yoast breadcrumbs are not being used and therefore the primary category is not used. Temporarily switch to Twenty Seventeen or Storefront (adding the appropriate code mentioned above) and see if the breadcrumbs display the primary category. If this works, we know the issue is related to the replacement code not working in your theme.
Unfortunately, that means the theme inserts WooCommerce breadcrumbs at a different point and the developer should be able to tell you how to interact with the WooCommerce breadcrumbs. Providing the code mentioned above should help the developer identify which actions and/or filters are needed for their theme setup.
Thanks @amboutwe
Does this match the separator you see on product categories?
Are you referring to the divider between the parent and child categories on the product pages of my site just above the price? e.g. this page
If so, changing the divider has had no effect.
In that case, is it this code you’re referring to when you say
Temporarily switch to Twenty Seventeen or Storefront (adding the appropriate code mentioned above)
?
Are you referring to the divider between the parent and child categories on the product pages of my site just above the price?
Yes. The breadcrumb divider would be what appears between parent and child categories.
In that case, is it this code you’re referring to…
Yes. That code is generalized and works for a lot of themes. Your theme may work differently.