Scenario
You own a gym that requires membership, and there are several activities at the gym including a Spin Class. The activity is only available to those who have an active membership and must be booked in advance.
Products Used
- WooCommerce
- Groups
- Groups for WooCommerce
- WooCommerce Subscriptions
- WooCommerce Bookings
Setup and Configuration
Create a Group
We’ll need to first create a group used for those that subscribe to your product. Those subscribed to your product will be added to the group and given access to additional products that are otherwise hidden from the public.
- In the sidebar of your WordPress Admin, click on Groups > Capabilities.
- Click on the New Capability button on the top.
- Under Capability type gym_membership, then press Add.
- In the sidebar of your WordPress Admin, click on Groups > Groups.
- Click on the New Group button on top.
- Fill out the Name field. I called mine
Gym Membership Activities
. - Click on Capabilities and add the newly created capability. Then click Add.
You’re set! You’ve created a group that we’re going to assign users to.
Create a Subscription
We need to set up a Subscription Product to sell to our customers and assign it to a new group we created earlier.
- In the sidebar of your WordPress Admin click on Products > Add New.
- Give your product a name like Gym Membership.
- We’ll now want to set up the Product Data. The type will be Simple Subscription and I’ve set the price to be $75 per month.
- Select the Groups tab then select on the Add to Groups field box. You should have the option now to choose the selected group you created earlier. Add the group and press Publish for your product.
Whenever someone purchases this product, it will automatically add them to the Gym Membership group. If a user cancels, it will automatically remove them from that group. Only active subscribers will be in the group.
Create a Bookable Product
Now we want users to be able to book activities based on the membership they purchased previously. We want to ensure however that only active members of the subscription have access to view this product.
- In the sidebar of your WordPress Admin click on Products > Add New.
- Give your product a name like Spin Class.
- Setup the Product Data to be a Bookable Product.
- We’ll set up some basic rules for the bookable product. The event is free, fixed block of 1 day, and only available on Saturday and Sunday.
- Now, within the “Groups” box in the Product Edit page’s upper right column, click on the field for Read. Select the new group that we created earlier.
Publish the product, and you’re set! Only those that have access to that group will be able to view this product; it’s also hidden from your shop pages.