hey there,
im developing a site that you can book field trips with, but i have a bug, when trying to order more then one trip (it is added to the cart at the moment you click order now), and then doing a check out, it books all of the cart items (booking items) into the last day i have booked for, for instance, i booked for the 12.5 and the 13.5 and they are both on the same cart, the calender will book them both for the 13.5 what can cause a big mass for the owner of the site.
i thought that if i could make the button to just send me to the checkout page instantly on clicking order now, it will solve the problem.
If you are using the Booking API, you can do this:
import wixBookings from "wix-bookings"
$w.onReady(async () => {
let availability = await wixBookings.getServiceAvailability("87edd4e0-42b1-4802-8766-584f3eeb6436") //Service ID
let slots = availability.slots
let chosenSlot = slots[1] //Chosen slot available to booking
let formFieldValues = [
{
_id: "20657271-c55f-43d6-adfd-39b7acc38e11", // name field ID
value: "John Doe",
},
{
_id: "87edd4e0-42b1-4802-8766-584f3eeb6436", // email field ID
value: "john@doe.com",
},
]
let bookingInfo = {
slot: chosenSlot,
formFields: formFieldValues,
}
let options = {
paymentType: "wixPay_Offline", //Here you can define the payment method
couponCode: "thecouponcode", //Here you put the coupon code
}
let booking = await wixBookings.checkoutBooking(bookingInfo, options)
let bookingId = booking.bookingId
let bookingStatus = booking.status
console.log(bookingId, bookingStatus)
})