WordPress.org

Support

Support » Plugins and Hacks » How to get current category and parent category – API?

How to get current category and parent category – API?

  • woocomuser
    Member

    @woocomuser

    Hi,

    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.

    For example:
    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… 🙂

    http://wordpress.org/extend/plugins/woocommerce/

  • The topic ‘How to get current category and parent category – API?’ is closed to new replies.