After going through the Forum, we got the code for showing categories as Breadcrumb in the Woocommerce but it is not as expected. We need to show all categories (Parent as well as sub categories ) in the products page. We need minimum 3-4 level of sub categories of the products to be shown. So expecting help in this matter.
Howdy, @bibhashkarn! Thanks for writing in…if you are using Pro, you can access all of the terms belonging to a particular taxonomy by using the All Terms Looper Provider along with the Layout Builder:
A quick way to get this going would be to drag in one of our new Terms Elements:
You can take one of those variations as a jumping off point and go to its Looper Provider and specify Product Categories as the provided taxonomy to pull in your WooCommerce categories.
If you are using X, you will want to look into using something like WordPress’ provided widgets to access certain taxonomies in a sidebar or something. Anything beyond that would likely require some custom development if that doesn’t suit your exact needs.
Hopefully that helps to point you in the right direction…cheers!
When I follow the above instructions (Looper provider: All Terms > Product Categories), the Looper Consumer is pulling in Post Categories, instead of WC Product Categories. Am I doing something wrong? Why could it be pulling in the wrong taxonomy?
Actually, We tried to do as per your suggestion but we were unable to do so. Can you guide through so that we can achieve above requirement. We are using PRO theme and the Breadcrumb is set to appear in the Header Builder of PRO theme. Breadcrumb needs to be appear everywhere in the website except Home page of the website.
I have checked your site and I do not see a breadcrumb on your homepage. The breadcrumb is displaying on other pages too. The categories (parent and sub-categories) on the breadcrumb are not displaying properly though. To add those categories, please check out this old thread to resolve your issue:
The categories and sub categories are displayed in alphabetical order. But we actually want something like Home > Shop > Category > SubCategory> SubCategory> SubCategory> Product
Did you created the code or has taken it from an older thread? Please be advised that to be able to accomplish what you need, custom coding is needed. We are unable to provide support for customizations under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, you may select our One or Care service for further assistance.
Thank you for the response. The code is taken from older thread as per your colleague suggestions. You can see the response at above discussion.
Sorry but we think this is some thing that has been solved but we are unable to find in the forum. For your reference the code is taken from older thread with below link.
Support includes any questions pertaining to features of the themes or plugins to which You hold a valid and unexpired theme or plugin license. Customization requests are not covered. For example, if You have a question about how to use the bar feature in Pro, a member of Our team will be happy to explain how it works. If You want custom code to change a core feature of the bar feature, that would not be covered. For the avoidance of doubt, a customization request is any request that looks to change something in the theme that can not be altered using native options. The manner and scope of support provided is at Our sole discretion.
By the way, please be advised that a product can have several parent and sub-categories. Adding all those parent categories in the breadcrumb may add confusion. The given code works as expected to display the categories in the breadcrumb. You can see it in one of your product page:
The breadcrumb format which is built-in the theme will usually display Home > Shop > Product Name. With the help of the custom code from the older thread, you now have Home > Shop > Category Parent > Child Category > Grand Child > Product Name.
If this is not what you need, please explain further.
Hello, Thank you for your response. We understand the limitation of support policy and we respect that. Thanks to the team members for their kind support.
Regarding our issue, we accept that the product can have several parent and sub categories. Only few products have several parent categories else they have only one parent category. There can be child and grand child category as you explained.
We are hoping same as you mentioned as Home > Shop > Category Parent > Child Category > Grand Child > Product Name with the above code but the order is not as mentioned. The categories are ordered alphabetically.
In the below link, Health & Safety is parent category and Skin Care is child, Lip Balm & Treatment is grand child but display order of category is as Home > Shop > Category Parent > Grand Child > Child Category > Product Name (In this product we have only one parent category, child category with one grand child category.) Even though of this the category is order alphabetical not in parent-child basis. https://www.hamroshringar.com/product/nivea-lipcare-strawberry-4-8-g/
WooCommerce displays the categories in alphabetical order. This order is then the one being picked up by your custom PHP code and returned for your breadcrumb.
Please edit your product and then uncheck “Health & Safety” and “Skin Care”. The remaining category should be “Lip Bam” and then check your breadcrumb again.
Thank you for the response. Default sort order of product category is alphabetical but we want somethin like “Home > Shop > Category Parent > Child Category > Grand Child > Product Name” as you mentioned above.
We have done as per your suggestion but after edit we have “Lip Balm & Treatment” only which is not as per our requirement. We also want “Health & Safety” and “Skin Care” in the breadcrumb sorted in the parent > child wise instead of sorted alphabetically.
The code you are using, the category for the specific product return in alphabetical order. While you are adding it into another array to display, it arranges in the way you are seeing it currently. The following article may help you with this.
Please remember that this code is a sample code, and it varies from case to case, and we can’t guarantee it works for you.