top of page

Forum Posts

Luke Ertzberger
Apr 08, 2024
In Velo (Wix Code)
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. 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. 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 this console 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 select a specific slot under `BookedEntity` it works fine, however, when I try to use a schedule as shown above, it gives the error. Please advise on how to proceed.
0
1
13

Luke Ertzberger

More actions
bottom of page