- Blog
- Contact
- Plugins
- Affiliates
- Affiliates Enterprise
- Affiliates Pro
- Affiliates Pro Contact Form 7 Integration
- Affiliates Pro Ecwid Integration
- Affiliates Pro EDD Integration
- Affiliates Pro eShop Integration
- Affiliates Pro Jigoshop Integration
- Affiliates Pro PayPal Integration
- Affiliates Pro s2Member Integration
- Affiliates Pro TheCartPress Integration
- Affiliates Pro WooCommerce Integration
- Affiliates Pro WP e-Commerce Integration
- Affiliates by Username
- Affiliates Extra Fields
- Affiliates Products
- Affiliates Share
- Affiliates Users
- Decent Comments
- FrankenCookie
- Groups
- Itthinx LazyLoader
- Lazy Widget Loader
- Open Graph Protocol
- Useful Plugins
- Support
- Shop
How to hide the WooCommerce Shop page
I’ve been asked if it is possible to hide the WooCommerce Shop page based on Groups’ access restrictions. As it is, trying to apply the normal way (checking a capability in the Access restrictions of the page) simply doesn’t work.
So what does work? Here’s an example:
Let’s assume that you are protecting your pages using the standard groups_read_post capability, any user that belongs to a group with that capability should be able to access the Shop page.
Create the woocommerce folder under the base folder of your active theme and copy archive-product.php from woocommerce/templates there.
At the top of your fresh copy, insert:
if ( class_exists( 'Groups_User' ) ) {
$redirect = true;
if ( $user_id = get_current_user_id() ) {
$user = new Groups_User( $user_id );
if ( $user->can( 'groups_read_post' ) ) {
$redirect = false;
}
}
if ( $redirect ) {
wp_redirect( get_bloginfo( 'home' ) );
}
}
… right before:
get_header('shop');
This will redirect visitors who try to access the Shop page to the site’s home page.



Please follow the Support guidelines.
Premium Support is available for customers in the Forums.