When there are multiple possible breadcrumbs, WooCommerce picks the first possibility. If the product is found from following a different path, the breadcrumbs no longer match the expected order. To make the breadcrumbs match the path used to reach the product I used the following strategy:
Use a cookie to record the last visited product archive page.
On the single product page, generate a list of all possible breadcrumbs.
Hide all the breadcrumbs except for the desired path.
Step 1 – Record the Cookie
This goes in [url removed, login to view] template at the very top before any information is outputted -> from line 2 to 9
Step 2 – Generate All Possible Paths
This goes on the [url removed, login to view] page. By default, I hide them all except for the first one using CSS. The .first class provides a distinguishing element to select -> from line 83 to 119
Step 3 – Show the active breadcrumb
i added script in header and footer plugin -> Before the </BODY> closing tag (footer)
now my custom breadcrumb is at the bottom of single page product and it's working right ( i think)
i want to use it instead the original breadcrumb in all pages
can you help me? or if you have a different solution to have a different breadcrumb for multicategory products explain to me.
16 freelancers are bidding on average $33 for this job
Let connect on chat and begin the project Relevant Skills and Experience Having good hands of experience in Plugin development & customization. Proposed Milestones $20 USD - milestone