Overview & requirements ↑ Back to top
WooCommerce Memberships can be used with Sensei to restrict course and lesson access for learners unless they have an active membership. However, to do so, you should note a couple of requirements:
- Courses should not be tied to WooCommerce product purchases; this causes a conflicting situation in which Sensei says the user has access, but Memberships does not. Allow Memberships to control access completely.
- If you use Sensei < version 1.9.15, you will need a small custom code snippet to add full compatibility (shared in this document). If you're not sure how to add custom code snippets, please review this guide.
Restrict lessons & courses ↑ Back to top
When you set up your courses and want to control access via the membership, you’ll need to ensure your Sensei settings illustrate this, the course setup, and your membership plan. Finally, you’ll need a small custom code snippet to glue them all together (provided below).
Sensei settings ↑ Back to top
When setting up Sensei with WooCommerce Memberships, if you’d like Memberships to handle course access, it’s important that you configure one Sensei setting: automatically start course access when a membership is activated. You can find this in the Sensei settings under “WooCommerce Memberships”:
Next, ensure that any lessons you want to control access to via Memberships are not tied to WooCommerce products. This is important: If Memberships is restricting access to the course and lessons, Sensei needs to let it do so 🙂 In order to accomplish this, you must ensure Sensei doesn’t think it needs to make the course available.
Now you can restrict your course and lessons via your membership plan.
Membership plan ↑ Back to top
When setting up your membership and course access, you’ll need to individually restrict any courses and lessons that the user should have access to when purchasing this membership.
This will allow Memberships to fully control who has access to course and lesson content, and only give them access while the membership is active.
Finally, to fully support restricting course videos and content dripping, we’ll need to add a small code snippet.
Code snippet ↑ Back to top
Add this snippet where you keep custom code, such as in the free Code Snippets plugin:
The first / highlighted part of this snippet ensures that Sensei doesn’t display videos or “complete lesson” links until the member has access to the course.
The second part is optional depending on whether or not you want course videos accessible.
Customer views ↑ Back to top
When you let Memberships handle content restriction, the Sensei course and lesson content will only be accessible for as long as the membership is active.
Non-member ↑ Back to top
When a non-member views a course-overview page, the course, along with lesson content, will be restricted and display the membership “restricted” notice.
Courses will show the same notice, removing videos or other course details.
Members ↑ Back to top
When a member who has purchased access logs in, they’ll now see access to the courses they have, and can view lessons within the course.
If a member has access to a lesson, all lesson details are shown to the member.
If the member doesn’t have access, or will have access in the future, lesson details, such as the video and quiz links, will remain hidden.
Course videos ↑ Back to top
One special case worth mention are course videos. By default, these are pieces of public content to allow you to sell non-members on your course. As such, they’re shown to members and non-members alike.
If you’d like to hide the course overview videos, you can do so in 2 ways: by changing the way you add the video with a shortcode, or by adding an additional code snippet.
Restrict via shortcode ↑ Back to top
If you want to restrict specific course videos to your members, you can use the content restriction shortcode to do so. However, if you do use this shortcode, you can’t use a plain URL for the video — you must use the full embed link instead.
First, get the full embed code for the video. If you’re using YouTube, this will be under Share > Embed for example.
Then, when you paste this into the “Course video” box, wrap the restriction shortcode around your embed link.
This will ensure members can see the video, but non-members don’t see the overview. The shortcode method is helpful if you want to delay access to the overview video specifically as well.
Restrict all course videos ↑ Back to top
If you’d like to restrict all course videos, you can enable “Restrict course video” in the Sensei settings. This will hide all course videos from non-members rather than using them as a free preview.
This setting was added in Sensei 1.9.15. If you use an older version of Sensei and want to restrict course videos, please view the snippet below.
Code snippet ↑ Back to top
If you’d like to automatically restrict all course videos unless the member has access, you can use a custom code snippet to do so. This snippet will ensure that course videos are hidden unless a member has access to the course:
This does what the shortcode does to hide the video, but automatically for all course videos.
Questions & support ↑ Back to top
Have a question before you buy? Please fill out this pre-sales form.
Already purchased and need some assistance? Please get in touch via the help desk.
All done here? Return to the Memberships overview.