Search.../

cancelEvent( )

Cancels a Wix event and closes its registration.

Description

The cancelEvent() function returns a Promise that resolves to the newly-canceled Wix event after the specified Wix event is successfully canceled.

This function does the following:

Canceled Wix events cannot be "un-canceled." You can only delete and copy them.

Tip: You can copy a canceled Wix event if you want to reinstate it. Copying an event resets the event's status and registration status.

When using the API, you do not need to cancel a Wix event before deleting it. When using the Wix Events app in the Editor, you must cancel the Wix event first.

Only those with "Manage Events" permissions can cancel Wix events.

Note: This function requires elevated permissions to run.

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

Syntax

function cancelEvent(eventId: string): Promise<WixEvent>

cancelEvent Parameters

NAME
TYPE
DESCRIPTION
eventId
string

Event ID.

Returns

Fulfilled - The canceled Wix event. Rejected - Error message.

Return Type:

Promise<WixEvent>
NAME
TYPE
DESCRIPTION
_id
string

Wix event ID.

location
Location

Wix event location details.

scheduling
Scheduling

Wix event scheduling details.

title
string

Wix event title.

description
string

Wix event description.

about
string

Rich-text (HTML) content for the "About Event" section.

mainImage
string

The location of an image that represents the Wix event. This image is printed on the ticket (PDF format). The image file must be an image file from the Media Manager.

The URL format is: wix:image://v1/<uri>/<filename>#originWidth=<width>&originHeight=<height>[&watermark=<watermark_manifest_string>]

slug
string

URL-friendly version of the Wix event title. Unique across all Wix events in the same site.

language
string

ISO 639-1 language code of the Wix event. Use to translate content on forms, and so on.

_createdDate
Date

Date the Wix event was created.

_updatedDate
Date

Date the Wix event was updated.

status
string

Wix event status. Defaults to "SCHEDULED". One of:

  • "SCHEDULED". The upcoming Wix event is scheduled but has not yet started.
  • "STARTED". The Wix event has started and is in progress.
  • "ENDED". The Wix event has ended.
  • "CANCELED". The Wix event has been canceled.
registration
Registration

Registration details for the Wix event.

calendarLinks
CalendarLinks

"Add to calendar" URLs.

eventUrl
SiteUrl

Event page URL components.

form
Form

Registration form for the site guest to fill out with their contact details, and other information, as relevant.

summary
Summaries

Summaries of Wix event sales.

guestList
GuestListSettings

Guest list settings for the Wix event.

createdBy
string

ID of the creator of the Wix event. If the creator is not logged in when creating the event, the createdBy property is empty.

videoConferencing
OnlineConferencing

Online conferencing details for the Wix event.

assignedContactsLabel
string

The "Filter by:" drop-down option for filtering contacts by this event
in the Dashboard's Contact List page. This read-only property is automatically populated to comprise a "custom" prefix, the title of the event, and other suffixes added for uniqueness. Note that even if the title of an event is updated, the assignedContactsLabel does not change.

Related Content:

Was this helpful?

Cancel a Wix event

Copy Code
1import { wixEvents } from "wix-events-backend";
2import { elevate } from 'wix-auth';
3
4/* Sample eventId value: '9d720f99-1b5a-4141-9877-d32985391e18';
5*/
6
7export async function myCancelEventFunction(eventId) {
8 try {
9 const elevatedCancelEvent = elevate(wixEvents.cancelEvent);
10 const canceledEvent = await elevatedCancelEvent(eventId);
11 console.log('Success! Canceled event:', canceledEvent);
12 return canceledEvent;
13 } catch (error) {
14 console.error(error);
15 // Handle the error
16 }
17}
18
19/* Promise resolves to:
20{
21 "about": "Learn to handcraft leather goods using saddle stitching techniques, from choosing the leather to sealing the edges.",
22 "assignedContactsLabel": "custom.leather-crafting-101-a-course-by-christina-roth-1-",
23 "calendarLinks": {},
24 "categories": [],
25 "createdBy": "8a8b9b73-4da8-47a5-8268-4396e68a0605",
26 "_createdDate": "2023-02-03T10:56:59.721Z",
27 "description": "",
28 "eventUrl": {},
29 "form": {
30 "messages": {
31 "checkout": {},
32 "registrationClosed": {},
33 "rsvp": {
34 "noMessages": {},
35 "waitingMessages": {},
36 "yesMessages": {}
37 }
38 }
39 },
40 "guestList": {
41 "public": true
42 },
43 "_id": "9d720f99-1b5a-4141-9877-d32985391e18",
44 "language": "en",
45 "location": {
46 "address": {
47 "formatted": "Tacoma, WA, USA",
48 "location": {
49 "latitude": 47.2528768,
50 "longitude": -122.4442906
51 },
52 "city": "Tacoma",
53 "subdivision": "WA",
54 "country": "US",
55 "streetAddress": {
56 "name": "",
57 "number": "",
58 "apt": ""
59 }
60 },
61 "name": "Tacoma",
62 "tbd": false,
63 "type": "VENUE"
64 },
65 "registration": {
66 "rsvp": {},
67 "tickets": {
68 "highestTicketPrice": {},
69 "lowestTicketPrice": {},
70 "tax": {}
71 }
72 },
73 "scheduling": {
74 "formatted": "Time is TBD",
75 "hideEndDate": false,
76 "showTimeZone": false,
77 "startDateFormatted": "",
78 "startTimeFormatted": "",
79 "tbd": true,
80 "tbdMessage": "Time is TBD"
81 },
82 "slug": "leather-crafting-101-a-course-by-christina-roth-1",
83 "status": "CANCELED",
84 "summary": {
85 "rsvp": {},
86 "tickets": {
87 "revenue": {},
88 "totalSales": {}
89 }
90 },
91 "title": "Leather Crafting 101, A course by Christina Roth (1)",
92 "_updatedDate": "2023-11-08T11:56:16.000Z",
93 "videoConferencing": {
94 "session": {}
95 }
96}
97*/