deleteResource( )


Deletes a resource.

The deleteResource() function returns a Promise that resolves to the resource ID when the resouce 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.
  • Only users with the Bookings Admin role can delete a resource. You can override the role permissions by setting the options.suppressAuth parameter to true.

Notes:

  • The Bookings app creates a resource with "business" in name and tag values. 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.
Method Declaration
Copy
function deleteResource(resourceId: string, options: Options): Promise<string>;
Method Parameters
resourceIdstringRequired

ID of the resource to delete.


optionsOptions

An object representing the available options for deleting a resource.

Returns
Return Type:Promise<string>
Delete a resource
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { resources } from "wix-bookings-backend"; export const myDeleteResource = webMethod(Permissions.Anyone, (resourceId) => { const options = { suppressAuth: true }; return resources .deleteResource(resourceId, options) .then((deletedResource) => { return deletedResource; }) .catch((error) => { return error; }); }); // Resolves to a string containing the deleted resource ID. // For example: "3f9215e0-7e96-417f-9c16-628e71c77311"
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?