• Resolved genepine

    (@genepine)


    Hello
    When I go directly to my Woocommerce store page, it shows up. The settings are set to restrict.

    Content Restriction – Restrict – Pages, Products
    Show Login Form – Pages
    Custom Post Types – Add to WP-Members Settings – Products

    • This topic was modified 1 year, 10 months ago by genepine.

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

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

    (@genepine)

    I add version info.

    WordPress 6.2.2
    PHP 7.4.3
    mysql 8.0.16

    Plugin Author Chad Butler

    (@cbutlerjr)

    it shows up” – what’s the “it” that’s showing?

    Thread Starter genepine

    (@genepine)

    Thanks reply.
    My frontpage(Restrict setting) -Pages
    https://membership-shop.sample.org/
    My shoppage(Restrict setting) -Pages
    https://membership-shop.sample.org/shop *1
    I input directly *1 url to browser, its could open, that shoppage products was shown. Login form not shown.

    Plugin Author Chad Butler

    (@cbutlerjr)

    Ahhh – I think I understand what you’re getting at.

    The WooCommerce shop “page” is not actually a “page” in the WordPress sense of the term. It’s actually an “endpoint”.

    The way that WP-Members works in general is to filter content using WP’s the_content filter hook on content that is singular (i.e. is_singular).

    There are, however, ways to block the WooCommerce shop (as well as other WC endpoints, and the endpoints of other plugins that operate in a similar way).

    You can use the WP-Members wpmem_redirect_to_login() function to redirect the user to the WP-Members login page. To block the WooCommerce shop page, you can do that by hooking to an early action (like pre_get_posts), check if the user is logged in and if it’s the WC shop page (using is_shop()), and redirecting if the user is not logged in.

    I don’t like to hard-sell upgrades, which is why I explained in the previous paragraph how you can do it without any help from me. But there is a more complete, “cut-and-paste ready” example of this in the WP-Members code snippet library which is available to premium support subscribers. It is also included as one of the many settings available in the WP-Members Advanced Options extension.

    Thread Starter genepine

    (@genepine)

    Hi
    That’s awesome answer, I’ll try!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘go directly to Woocommerce store page, it shows up’ is closed to new replies.