• Resolved rhonda8181

    (@rhonda8181)


    Does this plugin just not work o the woocommerce shop page?!! that is all I needed it for really

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter rhonda8181

    (@rhonda8181)

    Update: I was able to get woocommerce booster which allows me to restrict individual products by user roles but I would like to know why this plug in isn’t working to restrict pages by permissions I have set.

    Thread Starter rhonda8181

    (@rhonda8181)

    Well let me add it IS restricting the Training page just not the Shop page.

    Plugin Contributor Awaken Solutions Inc.

    (@awakensolutions)

    This is because the WooCommerce Shop page is not a standard WordPress page and cannot be targeted by the mechanisms of this plugin.

    As per this WooCommerce article:

    The Shop page is a placeholder for a post type archive for products. It may render differently than other pages in your install.”

    As an alternative solution, you could create and then assign a custom page for Shops in WooCommerce, or write your own page template. But this plugin can’t manage the hiding of the actual products for the above-mentioned reasons.

    Hi All

    rhonda8181, as plugin author has said, however you can use the following to bypass the restriction in your WooCommerce archive-products.php template:

    <?php if ( is_user_logged_in() ) { ?>
    content visible for logged in users
    <?php } else { 
    $simple_restrict_restriction_message = get_option( 'simple_restrict_setting_one' );
    echo $simple_restrict_restriction_message;} ?>

    The above will simply restrict the woocommerce shop page to non logged in users. If a user is not logged in, the above will spit out whatever is set in your Settings>Simple Restrict>Restriction Message.

    Unfortunately the above will not pick up the restrictions set by the plugin. For that, you would need to play around with
    wp_get_current_user();
    and match the user ID you can get from the above function with the plugin restrictions it has created.

    Note that you have to have WooCommerce support enabled and plugin files copied over to your theme/woocommerce/ to be able to edit the archive-products.php. You can declare WooCommerce support with the following line in your functions.php :
    add_theme_support( 'woocommerce' );

    Plugin Contributor Awaken Solutions Inc.

    (@awakensolutions)

    Thanks for posting this additional info artsfantasy.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Not restricting my shop page’ is closed to new replies.