How can I get a currentUser's booking history?

I want to customize different booking flows for new member and old member correspondingly. Specifically, if a member never make a booking, the schedule only shows two months timeslot, while a member that already booked a service before and see up all the timeslot available.

I couldn’t find anywhere to retrieve a user’s confirmed booking. Any advice is appreciated.

Hi,

How are you currently displaying your schedule? Have you created your own custom bookings pages?

Perhaps you can display your bookings availability on two different pages, one for members that have booked and the other for new members. You can use the wix-bookings > getServiceAvailability() function to get the available time slot for a specific service and display it on a repeater for example, and then input your logic that will display the availability based on currentUser and check if they’ve booked a service previously.

I’d recommend taking a look at the articles, Building Your Own Members Area for custom members pages and Creating a Custom Bookings Experience as reference.

I hope this was helpful.

Best regards,
Miguel

Thanks Miguel. It is exactly what I am planning to do. Just I don’t know how to get the currentUser’s booking history. Any idea?

Hi Miguel, do you know how I can get the currentUser’s booking history? Your advice is very much appreciated. Thank you.

Hi Leung,

Currently, there isn’t a direct way to retrieve the currentUsers booking history. You will most likely need to create this flow manually.

For example, you can try storing the currentUsers email, bookings serviceID and Date into a separate collection upon checkout and use that data to display the relevant availability on a page with the API’s I mentioned previously.

You may also want to use data hooks if you want to manipulate your data before it’s entered into the collection.