Question:
How can I get all of the dates of a scheduled course session using velo and the booking API? Right now I can only retrieve the start and end dates.
Product:
Wix Studio Editor, Wix Velo, Wix Booking V2 API
What are you trying to achieve:
I am making a site for a pottery studio. They offer several courses at a time. For example, they have 3 Intro to Pottery Classes going on right now. Each Intro to Pottery class is set up as its own course service in my Bookings.
I have a collection where all courses of the same kind are linked, and a dynamic page for each. For example, I have an “Intro to Pottery” page with a multi-reference with each Intro to Pottery Course.
I want to make a dropdown where a customer can choose a specific course and see all the dates that will be included with that course.
What have you already tried:
Dataset Query
On the dynamic page, using $w('#dynamicDataset').getCurrentItem()
doesn’t show any scheduling information.
Services Query - Bookings v2
If I query the specific service ID like this:
const courseDetail = services.queryServices().eq("name", serviceName).find().then((res) => {
console.log(res.items)
}
returns the following schedule info:
type: "COURSE",
...
schedule: {
"firstSessionStart": [DATE]
"lastSessionEnd": [DATE]
"availabilityConstraints": {
"sessionDurations": [
150
],
"timeBetweenSessions": 0
},
"_id": [ID]
getServiceAvailability - Bookings Frontend
Using getServiceAvailability from wix-bookings-frontend like this:
getServiceAvailability(ID).then((availability) => {
console.log(availability.slots)
returns and array with one object:
_id: SERVICE_ID
startDateTime: FIRST_CLASS_DATE
endDateTime: LAST_CLASS_DATE
serviceId: SERVICE_ID
capacity: 9
remainingSpots: 9
staffMemberId: STAFF_MEMBER_ID
bookable: true
Any help or insight would be much appreciated!