I'm developing a site which will offer a range of webinars that customers can buy individually. Initially, we will only offer two courses, but we intend to expand over time. Each course will contain a series of videos, PDFs, tasks, and suggestions for additional reading.
I am wondering what the best setup for this type of site would be? My first thought was to set up each course as a product in WooCommerce, and then find a way to "open" up access to the relevant posts when this is done. The intention is not to simply let the customer download the files, but rather get access online... I have considered setting this up through the use of Toolset Access, but that would create trouble as more courses are added, and people may have any combination of courses linked to their account. Is there an easy way to allow Woocommerce purchases to be linked to certain pages?
Thanks in advance for all help!
Hi, there's not an easy way to set up this type of flexible access system based on product purchase. Access control uses Post Groups or User roles, but those are somewhat rigid and difficult to manage when you have multiple products. One way I can think of to set this up with Toolset is to use conditional HTML to show and hide specific content from specific Users, based on a custom field or custom fields. It will require some knowledge of PHP. Here's how it could work:
- Create a custom field group for Users. Add a radio button custom field for each webinar. The names of the custom fields should match the post slug for the corresponding Webinar. The values will be 0 or 1, to indicate whether or not a User has purchased a specific Webinar. The default value should be 0, to indicate the User has not yet purchased the Webinar.
- As new Webinars are added, create a new custom radio button field to correspond to that Webinar using the appropriate slugs.
- Add conditional HTML to your Webinar Content Template to show or hide specific pieces of content, like download links or video content. Test the value of the current User's corresponding radio button. If it's 1, then show the content. If it's 0, hide the content. This does not prevent a User from downloading content if he or she has a direct link to the content, it only manages display of the content or display of the links to download the content.
- Use a Commerce Form to handle adding a Webinar to the User's cart. This is how Users will purchase access to new Webinars. Add a generic field to the Form that includes the current Webinar slug.
- Use the Forms Commerce API to set the value of that User's corresponding webinar custom field radio button to be 1 when the purchase is complete. This will unlock access to the Webinar because the conditional will now be true.