Search.../

deleteResource( )

Developer Preview

Deletes a resource.

Description

The deleteResource() function returns a Promise that is resolved when a resource is deleted.

Deleting a resource updates its status to DELETED.

You cannot delete a resource if it has booked sessions.

Notes:

  • The Bookings app automatically creates a resource with a name and tag of value "business". This resource is used for the business's schedule and working hours and cannot be deleted.
  • You can have up to 135 active resources and an additional 135 deleted resources.

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

Syntax

function deleteResource(_id: string): Promise<wix-bookings-v1.Resources.DeleteResourceResponse>

deleteResource Parameters

NAME
TYPE
DESCRIPTION
_id
string

ID of the resource to delete.

Returns

Return Type:

Promise<
DeleteResourceResponse
>

Was this helpful?

deleteResource example

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