• Hi there.

    I’m running on online shop using WooCommerce and have hidden certain pages from non registered customer using the plugin ‘member access’ (‘https://www.ads-software.com/extend/plugins/member-access/) which allows me to manually configure what user roles are allowed to see what pages. So I’ve set the WooCommerce shop base page to ‘Shop’, and using the plugin I’ve made it only accessible to registered customer using an assigned user role after registration.

    However, it isn’t working, and I think it’s to do with WooCommerce.

    I have no idea. Can somebody please help I’m super stuck on this issue for a client.

    Thank you in advance for any advice.

    Aaron

Viewing 4 replies - 1 through 4 (of 4 total)
  • gxb101

    (@gxb101)

    This issues has plagued me for the last 2 days and I am happy to report I found a workaround. The problem is that any plugins which can limit access by user level do not work on woocommerce “core” pages (ie: the shop page). So, what you must do is edit the archive-product.php file (found in the woocommerce root dir) and add some custom php code to the very top such as this:

    if( !is_user_logged_in() ) {
    	wp_redirect(some-page-on-your-site);
    }
    else{
    [the remaining original php code follows here...]

    What this will do is check to see if the user is logged in and redirect them to some other page is they aren’t, else they will see the page as intended. The trick is to redirect them to some other page which makes them either login or register for site access.

    Problem solved.

    I tried this and I got an error further down in the archive-product.php file.

    What is the exact string that I need to put in here: wp_redirect(some-page-on-your-site);

    I tried these: wp_redirect(https://website.com);
    wp_redirect(“https://website.com)”;
    wp_redirect(‘https://website.com’);

    None of them worked.

    Hi, here is what I used at the very top:

    <?php
    if( !is_user_logged_in() ) {
    	wp_redirect(get_permalink(24));
    }
    else{

    [the rest of the original .php code….]

    Just had the same issue while using the Groups plugin to the same end. Posted a comment on the author’s site and he produced a workaround:

    https://www.itthinx.com/2013/02/12/how-to-hide-the-woocommerce-shop-page/

    To the OP, if you can replicate in Groups what you’re doing in Member Access, this might be a solution for you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Need to hide WooCommerce 'shop' page to non members’ is closed to new replies.