Search.../

updateNumberOfParticipants( )

Developer Preview

Updates the number of participants for a booking.

Description

You can only update the number of participants for class and course bookings, you can't update it for appointment bookings.

Calling this method also changes the session's totalNumberOfParticipants.

When updating the number of participants for a booking you must pass either participantsChoices or totalParticipants. If you pass participantsChoices for services that have variants, all of the provided choices must exist for the service. Otherwise, the call returns an INVALID_SERVICE_CHOICES error.

This function is not a universal function and runs only on the backend.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function updateNumberOfParticipants(bookingId: string, options: UpdateNumberOfParticipantsOptions): Promise<UpdateNumberOfParticipantsResponse>

updateNumberOfParticipants Parameters

NAME
TYPE
DESCRIPTION
bookingId
string

ID of the booking to update the number of participants for.

options
UpdateNumberOfParticipantsOptions

Returns

Return Type:

Promise<
UpdateNumberOfParticipantsResponse
>
NAME
TYPE
DESCRIPTION
booking
Booking

Booking with updated number of participants.

Was this helpful?

updateNumberOfParticipants example

Copy Code
1import { bookings } from 'wix-bookings.v2';
2
3 async function updateNumberOfParticipants(bookingId, options) {
4 try {
5 const result = await bookings.updateNumberOfParticipants(bookingId, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13