In this tutorial, we want to focus on fitness session booking, where besides date and time, the customer can also choose:
- the duration of the session
- the trainer (and opt for the expert one at a higher cost)
We will also focus on an alternative where the trainer will be automatically assigned, instead of being chosen by the customer.
We’ll create one resource for each trainer and one product for the fitness session, where we will link the resources.
Let’s start then.
Resources
Let’s start with the resources’ configuration, so we can set each trainer’s availability.
Let’s go to YITH > Booking > Configuration > Resources and click on “Add new resource”.

Let’s call it with the trainer’s name, Jimmy in this case, set availability quantity to 1, and set his working days as available every day except for Mondays, his weekly day off.

As Jimmy is available for the whole day, we don’t have to set up specific hours here, we will set hours in the fitness session product, which will automatically restrict Jimmy’s availability as well.
We will add some more extra rules for his vacation for August 15-31. Let’s click on +Add rule in the Additional availability rules, then set the rule type to Generic dates and add the time range. We’ll set these days as Not bookable.

We’ll set the other trainers similarly, but with different days off and vacations.
Product
Let’s move on now to the product settings.
We can create a new product, give it a name, and set it to “bookable product” and “virtual“:

Now, you’ll see the Booking Options tab where you can add all your settings.
If you can’t see one or more of the sections, make sure you have activated the related module as explained here.
Step 1 — settings
In the Settings section, we will set the booking duration as Customer can book units of 1 hour, because our sessions by default lasts one hour.

Then, let’s scroll down to the Booking terms.
Here we’ll set up maximum bookings per units to 0, that stands for unlimited. Yet, this value will be further restricted by the resources’ availability, so, only free slots with at least one resource will be available.
Additionally, as we want to offer the opportunity to extend the session to a maximum of 3 hours, we will set a minimum booking duration to 1 and maximum to 3.

Step 2 — costs
In the Costs tab, we can set a base price of $30 per hour.

Yet, for customers who book a 3-hour session, we want to offer a 10% discount, so instead of $90, they would pay $81. For this, we can scroll down and add an advanced price rule based on the duration unit, as you can see below:

step 3 — Availability
In the Availability section, we will set the gym opening hours, so every day from 8:00 to 13:00 and 15:00 to 20:00 except for Sundays.

Step 4 — Resources
Let’s set up the Resources now, so our trainers. First of all, we have to enable the toggle button, then set the Resource assignment to Customer can select one resource and enable the Required option, so no bookings can be submitted without a trainer.

We can also set the labels as we want them to appear on the cart and in totals and on the product page.
Now, we can scroll down and finally add the resources, click on Add resource and select all the trainers who can offer this fitness session.


For the expert trainers, we can add an extra cost in the resource settings, for example, we will add an extra cost of $5 for Chris and Jane.

And that’s it!
Let’s check our product on the front end then.
The customer will be asked to select the trainer first. Here I’ll be able to see the extra price for expert trainers.
Then, choose the date and time and the session duration.
Based on the resource and the duration, the calendar availability will be automatically updated.
For example, if I select Jimmy, who is on vacation from August 15 to 31, I will not see those dates visible in the calendar.
Also, if I want to book a 3-hour session, the only available times in the morning are 8:00, 9:00 and 10:00, because the gym closes at 13:00.
Finally, for a 3-hour session, I can also see the price discounted by a 10%, so pay $81 instead of $90.
Setting up a bookable product has never been so easy. Have fun!