How to get current category and parent category – API?
I am trying to implement my own custom breadcrumbs for WooCommerce. It is a very customised solution that cannot be achieved with a plug-in. So, to cut a long story short I am having issues defining what the parent category of a product is when the product is associated with multiple child categories who all have different parents. Woo always reports the same parent (top-level) category; even though it could be one of three categories.
If the same product is in the following three categories…. red/dark, blue/light, green/medium and…
The website visitor selected green and then medium and then the product, he would then be viewing the product details page, related to green/medium category. I need to know that the current parent category is green. BUT no matter what navigation route the user takes Woo always reports the same category and the product always ends up with the same URL/permalink.
I hope I have made sense above and someone may be able to aid with this issue.
Thanks in Advance… 🙂
- The topic ‘How to get current category and parent category – API?’ is closed to new replies.