Skip Navigation

[Resolved] Control the WooCommerce Shop with Toolset Access

This thread is resolved. Here is a description of the problem and solution.

Problem:
Toolset doesn's seem to apply any rule (wether post type, post group or WPML group) to the as "shop" designated page used with WooCommerce.
How can we control who can see the ship with Toolset Access?

Solution:
Toolset Access allows the control over Post Types - hence if you control products (the post type "products") with Toolset Access and remove reading rights from a role as an example, that role still can see the shop "page" itself but no products listed in it.

Hiding the single Shop "page" by controlling the post Type "Page" or with a Post Group or even WPML group doesn't work.
This is because the Shop "page" becomes an archive as soon you designate it for WooCommerce's shop "page".
Archives cannot be controlled directly by Access but only it's contents (the products, in this case).

This is the same on any other archive (taxonomy, post, etc).

If you need to fully control who can access the very shop page, you can find a workaround here:
https://toolset.com/forums/topic/something-not-working-with-shop-rules/#post-1268959

This support ticket is created 5 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Author
Posts
#1268923

Ok, i made a TEST site: hidden link where you can make tests... same users.
Now I removed the WPML rule, and it's working!!!

Only a small problem remains: the SHOP PAGE, also if I have an Article Group rules that don't allow subscribers to view it... stay visible! hidden link

The rule remove the SHOP from the menu, but the direct access ifs possible...

#1268933

I think here you refer to the page that WooCommerce creates for the shop and that's not a page, it's an archive.
However, when I was a guest try to visit it, I am redirected to a login:
hidden link

I don't have subscriber access to your site, or Admin access, to confirm and adjust this issue.
Can you provide the required access data and links to where I see the issue in order for me to confirm it, analyse and eventually fix this problem as well?

#1268959

OK; I found access details in the other thread as well (our replies crossed), but now I see this is the WooCommerce Shop Archive, and you can control archives output only by controlling the posts displayed in that archive.
So, setting a Post Group to make the page visible or not, is not the right approach to hide/show this archive, however a control over the post type "product" would be adequate to do.

I see on your site this is done already as well, still, the subscribers can see the shop archive(page) and it's products.

Locally on a fresh install, if you control products (the post type "products") with Toolset Access and remove reading rights from a role, that role still can see the shop but of course, no products in it.
Now hiding the single Shop page with a Post Group doesn't work.
This is simply because the Shop page is no page, it's an archive, in fact, and an archive cannot be controlled directly by Access but only it's contents (the products).

It's a bit confusing, because WooCommerce does this trick of faking a page while it uses an archive in fact, but it's expected.
It's also a bit of a usability issue, given that the end user doesn't know necessarily that the page chosen as shop becomes an archive, and expects it to listen to Access Rules like it'd be a Page, not like it'd be an Archive of posts.
However you can confirm, the shop is no page, by heading to your site/shop and searching for the "Edit page" button in the admin bar: it won't be there as that's, in reality, no page anymore but an archive of products.

I think we cannot change a lot here since other archives also work the same way:
You can control content within it, but not the archive itself which will always display.

You could workaround this by creating a View to display your products like in a Shop and then put that View to a page, which can be controlled by Access, or, you can use Custom Code to for example redirect the Subscriber Role to other URL's if /shop is called by a Subscriber.

Please let me know if you need help with this. Note, you can very well remove the products from subscribers, and display any error you want for single products, but you cannot control the archive template per se.
That also means if you edit the archive with Views, you could actually bring in a totally different template for the Archive Loop, if this is a subscriber.

#1269395

Ok, all clear!

It's not so important form me, I've hided the SHOP from the menu to subscribers, so no problem!

THANKS A LOT!!!

#1269397

My issue is resolved now. Thank you!