Enforce read access on WooCommerce Categories via Parent/Child heirarchy inheritance

Hi Guys,

I’m running WooCommerce with Groups & Groups Restrict Categories. I have many streams of Product Categories (each with many children Product Categories) and I would like to set the read access ‘capabilities’ to a parent Product Category, and have the same capabilities automatically inherited by the children Product Categories of the parent Product Category. With the option to manually set the ‘capabilities’ to a child Product Category and have it override any automatic inheritance.

I anticipate there will need to some additional caveats on this, where an individual Product with its own read access capabilities can either override it’s conflicting Category read access capabilities or it can adhere to enforcement. This could be set as either a global option from within the “Options” panel and/or can be set as an option per Category for granular override control.

At present, this inheritance of capabilities across read access of Product Categories does not occur, and you must manually set the read access for every child Product Category (a reasonable work around but could be improved).

Thanks.

3 Responses to Enforce read access on WooCommerce Categories via Parent/Child heirarchy inheritance

  1. Emma-Jane July 9, 2015 at 11:16 pm #

    Sorry, I forgot to give this context to the front-end. Let me clarify:

    Yes, I can see the capabilities are inherited, which is great – that’s working well! The issue I have is within the Sidebar widget WooCommerce Product Categories (Option: ‘Show Hierarchy’ enabled).

    Groups Restrict Categories is hiding the restricted Parent Product Category nav items, but it is not hiding the child Product Categories nav items. Do you have a function/hook/filter/action I can use it combo with WooCommerce hooks to target these child nav items?

    Thanks.

    • antonio July 10, 2015 at 5:16 pm #

      Hi Emma-Jane,
      sorry, I had misunderstood.
      Capabilities are inherited from Groups to Subgroups, but not in taxonomies. So it works as you say, you need to add the restrictions manually to the child categories.
      We will consider what you described for future updates, thanks for the suggestion.
      Regards,
      Antonio B.

  2. antonio July 9, 2015 at 6:13 pm #

    Hi,
    Capabilities are automatically inherited to the children categories.
    If you have:
    Animals
    –Dogs
    and ‘Animals’ has a capability ‘animalsCap’, then ‘Dogs’ has this inherited capacity.
    Relating to products, if we have ‘Necklace’ in the category Aninmals->Dogs with a capability ‘necklaceCap’.
    Only if the user has the capabilities ‘animalsCap’ AND ‘necklaceCap’ then he can see the ‘Necklace’ product.

    But thanks you for the suggestions.
    Regards,
    Antonio B.

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share