Question:
I have a service in Wix Bookings that I’m trying to add a booking for and then add it to the cart. However, I get an error unless I pick a specific slot. I want to do it for the entire course. Not a specific slot.
Product:
Wix Editor / Wix Bookings
What are you trying to achieve:
Similar to: https://www.wix.com/velo/example/custom-book-flow-on-booking-v2 - however my service is a “COURSE” type, not a booking one.
What have you already tried:
I used the below code:
import {bookings} from 'wix-bookings.v2'
import {elevate} from 'wix-auth'
const createBooking = elevate(bookings.createBooking)
const bookingObject = {
totalParticipants: 1,
bookingSource: {
actor: "CUSTOMER",
platform: "WEB"
},
contactDetails: {
firstName: currentMemberDetails.contactDetails.firstName,
lastName: currentMemberDetails.contactDetails.lastName,
email: currentMemberDetails.loginEmail
},
"additionalFields": [{
"id": "d62490a9-30a8-4235-bc3f-ed052ed6ea04",
"value": studentId,
}, ],
bookedEntity: {
tags: ["COURSE"],
schedule: {
scheduleId: serviceId,
serviceId: serviceId,
timezone: "America/New_York"
}
},
status: "CONFIRMED"
}
console.log('about to create with booking object: ', bookingObject)
const response = await createBooking(bookingObject, { sendSmsReminder: false })
But it produces the error:
message: 'Can\'t validate schedule availability for schedule a9076891-f4c2-4211-8507-4188f193fe96 due to FAILED_PRECONDITION: Failed to validate schedule availability: status: FailedPrecondition, code: FAILED_RESOLVING_SCHEDULE, description: Failed resolving schedule a9076891-f4c2-4211-8507-4188f193fe96 when validating schedule availability'
details:
applicationError:
description: 'Can\'t validate schedule availability for schedule a9076891-f4c2-4211-8507-4188f193fe96 due to FAILED_PRECONDITION: Failed to validate schedule availability: status: FailedPrecondition, code: FAILED_RESOLVING_SCHEDULE, description: Failed resolving schedule a9076891-f4c2-4211-8507-4188f193fe96 when validating schedule availability'
code: FAILED_VALIDATING_AVAILABILITY
data: {}"
If I replace the schedule with a specific slot under BookedEntity, it works fine, and I don’t get the error.
Additional information:
Looking for clarity on how to implement signing up for the course without signing up for a specific “slot” - the same as if I used the default registration for booking a “Course” through the UI.