Show a different set of sessions after customer has booked the introductory session?

We have a personal training service using the booking calendar feature. But we don’t want people signing up for sessions without first attending the introductory session where a trainer can evaluate them / their needs. We’d like to have the other available sessions hidden until then. Is there a way to automate this?

Product:
Wix Studio / dev

What have you already tried:
So far, we’ve found ways to hide / show sessions based on user roles, but these need to be changed manually.. We’d prefer if after the introductory session the user has full access to all of the training sessions automatically. Is it possible with the API at all?

To achieve this, you would have to write custom code which will check if the user has booked the introductory session and only then let them see or book your other sessions.

1 Like

Is that possible though? The booking API doesn’t seem to return users, does it offer a hook for this or is there something we’re missing?

Yes, it is possible using the queryBookings() function which allows you to query all bookings made by a specific contactId, which is essentially your member’s _id.

With this, you can either pass the hardcoded sessionId for your Introductory Class, or you can simply pass the contactId with status CONFIRMED and check if the logged in user has atleast one confirmed booking (meaning they have booked the introductory session) to list your other services.

1 Like

Thanks so much for your help Pratham. I’m wondering, does queryBookings() have the ability to return the date / time of a session? So theoretically we could use this information to detect if the logged in user (via contactId) has booked the specific session AND the time of that session has passed?

Oh yes absolutely!

queryBookings() does indeed return a start and end time for the booked service, and alternatively, you can also pass in the session end time while calling the function by setting the session’s endTime to le today. This way, the result will only contain sessions that have already ended in the past or today. Else your result.items.length would turn out to be 0, meaning the user hasn’t booked any session OR the introductory session isn’t complete yet.

1 Like