Change WordPress user roles and capabilities › Forums › Restrict or Permit access inside WordPress – how to › Restrict access to woocommerce product category not working, how to debug?
Tagged: woocommerce category
- This topic has 2 replies, 2 voices, and was last updated 3 years, 11 months ago by
[email protected].
-
AuthorPosts
-
15/12/2021 at 21:11 #7783
[email protected]
ParticipantI’m trying to restrict access for all users for one specific woocommerce category and allow it for one user role.
https://finecharmingnails.be/product-categorie/this-is-us/this-is-us-voor-professionele/Initial setup was allow for specific role (users with vat) and on customer role prohibit the view for that category, but that wasn’t working. So I’ve prohibited the view for All visitors (logged in or not) and I can still access it.
Is there any way to debug this to figure out why this isn’t working?
16/12/2021 at 02:55 #7784Vladimir
KeymasterIn order to exclude product from listings, you have to select action “404 HTTP error”. Content view restrictions protects directly only post/page content or full description for the products. It does not prohibit to theme or plugin to show any other product attributes, like price, image, etc. until you select the “404” or “redirect” action.
Take into account that you can set view restrictions directly for the product category.
16/12/2021 at 20:01 #7785[email protected]
ParticipantThanks for the reply, i’ve did some more testen, but the only thing i can do is block the product category for logged in users only.
I’ve tried setting the following on the product category itself, but that doesn’t do anything
Content View Restricitions
View Access:
o Allow View
x Prohibit View
For Users:
x All visitors (logged in or not)
o Any User Role (logged in only)
o Selected User Roles
Action:
x Return HTTP 404 error
o Show access error message
o Show custom access error messageNext step was to set the following on the vat-user role
Block: o Selected x Not Selected
x Return HTTP 404 error o Show access error message
And select every product category idBut since the setting on the product category doesn’t work i didn’t get this far 🙂
Setting up the user role as follow
Block: x Selected o Not Selected
x Return HTTP 404 error o Show access error message
And select a specific product category does return “no products found” -
AuthorPosts
- You must be logged in to reply to this topic.