While many membership or subscription plugins give you the ability to protect entire pages or portions of your content so that inactive subscribers or guests can’t access them, they don’t always give you control over your menu display. If non-members can’t access a particular page, you may not want it displayed in your navigation to them since the page won’t be useful.
Likewise, some pages are not useful members (such as pages intended to sell subscriptions to guests), and these can be hidden from active subscribers. To respond to these situations, you can conditionally adjust your menu based on user role.
This tutorial comes from a great idea from Member Up on using the If Menu plugin to control menus for members. We’ll adapt this to be specific to WooCommerce today, as WooCommerce Subscriptions is commonly used for membership-type sites and automatically adjusts roles.
This tutorial will let us create menus that respond to a WooCommerce subscriber’s status. When a subscriber has an active subscription, you can determine which role they have, and can set another role for inactive status. This will let us conditionally show / hide menu items based on subscriber status.
Here are the plugins we’ll reference in this article:
First, make sure you have at least If Menu and WooCommerce Subscriptions installed.
Under WooCommerce > Settings > Subscriptions, you can set up the roles that active / inactive subscribers will have. By default, active subscribers will have the subscriber role, while inactive subscribers will have the customer role.
If you want to set up custom user roles, you can do so with another free plugin: User Role Editor. This will let you create new roles, so you could create a “Member” role by cloning the customer or subscriber roles.
Note these roles, as we’ll use them to show or hide certain menu items.
Next, you can go to Appearance > Menus. When you create your menus, you can now enable conditional logic based on your user roles or a couple of other conditions.
If you want to show a menu item to your active subscribers, but no one else, choose “Show” if “User is Subscriber”.
(Note that your site admins will see any page restricted to other roles, i.e. navigation items only shown only to subscribers, so to test this you should use a different browser or user account.)
When a guest or an inactive subscriber views the site, this menu item will not be shown.
When logged in as an active subscriber, customers will see your subscriber-only menu item.
This can let you show items in the navigation to your active subscribers only, such as information about their subscription or membership. This does not restrict the page from direct access; rather, it only controls menu visibility.
You can also show items to non-logged in users only. Select “Hide” if “User is logged in” for your menu item that should be for guest users only.
This is a great way to include an upsell or sales page for your subscription / membership, but it will be removed for logged-in users so the sales page doesn’t distract logged in users.
Changing your navigation or other menus to respond to user statuses is a good way to make sure that active subscribers will have access to pages they need without the need to directly show these pages to your inactive subscribers or guests.
You can also show pages only to guest users, letting you upsell your membership or subscription without it getting in the way of your existing subscribers.
Your WooCommerce store can drive additional revenue by improving your email marketing. Try Jilt for free to increase sales with abandoned cart recovery emails, post-purchase follow-ups, and more!