Search.../

onOrderUpdated( )

A backend event that fires when a ticket order is updated.

Description

The onOrderUpdated() event handler runs when a ticket order is updated. The received OrderUpdatedEvent object contains information about the updated ticket order.

Note: Backend events are not fired when previewing your site.

Syntax

function onOrderUpdated(event: OrderUpdatedEvent): void

onOrderUpdated Parameters

NAME
TYPE
DESCRIPTION
event
OrderUpdatedEvent

Information about the ticket order that was updated.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

A backend event that occurs when a ticket order is updated

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3// Add the file if it doesn't exist.
4
5export function wixEvents_onOrderUpdated(event) {
6 let eventId = event.eventId;
7 let orderNumber = event.orderNumber;
8 let status = event.status;
9
10 let buyerFirstName = event.firstName;
11 let buyerLastName = event.lastName;
12 let buyerEmail = event.email;
13
14 let invoice = event.invoice;
15 let grandTotal = invoice.grandTotal;
16
17 let tickets = event.tickets;
18 let firstTicket = tickets[0];
19 let secondTicket = tickets[1];
20}
21
22
23/* Full event object:
24 * {
25 * "timestamp": "2020-04-28T12:24:29.768Z",
26 * "eventId": "566e7be9-1410-4095-ae7a-349a4ac95c6b",
27 * "orderNumber": "FMXC-BZG3-OT",
28 * "contactId": "eea3ac0f-f9e6-4ed3-a135-99743c8e90b8",
29 * "memberId": "b272b0bb-d013-415a-8461-e8a175fe8dc6",
30 * "created": "2020-04-28T12:23:51.523Z",
31 * "firstName": "John",
32 * "lastName": "Doe",
33 * "email": "john.doe@somedomain.com",
34 * "confirmed": true,
35 * "status": "PAID",
36 * "method": "payPal",
37 * "archived": false,
38 * "checkoutForm": {
39 * "inputValues": [
40 * {
41 * "inputName": "firstName",
42 * "value": "John",
43 * "values": []
44 * },
45 * {
46 * "inputName": "lastName",
47 * "value": "Doe",
48 * "values": []
49 * },
50 * {
51 * "inputName": "email",
52 * "value": "john.doe@somedomain.com",
53 * "values": []
54 * }
55 * ]
56 * },
57 * "tickets": [
58 * {
59 * "ticketNumber": "FMXC-BZG3-OT021",
60 * "ticketDefinitionId": "d72874cb-012a-4ad2-afbb-57fe8cf1e308",
61 * "checkIn": {
62 * "created": "2020-04-28T12:24:20.102Z"
63 * },
64 * "price": {
65 * "amount": "123.00",
66 * "currency": "USD"
67 * },
68 * "archived": false,
69 * "firstName": "John",
70 * "lastName": "Doe",
71 * "email": "john.doe@somedomain.com",
72 * "contactId": "eea3ac0f-f9e6-4ed3-a135-99743c8e90b8",
73 * "memberId": "b272b0bb-d013-415a-8461-e8a175fe8dc6",
74 * "confirmed": true,
75 * "form": {
76 * "inputValues": [
77 * {
78 * "inputName": "custom",
79 * "value": "Another comment",
80 * "values": []
81 * },
82 * {
83 * "inputName": "email",
84 * "value": "john.doe@somedomain.com",
85 * "values": []
86 * },
87 * {
88 * "inputName": "lastName",
89 * "value": "Doe",
90 * "values": []
91 * },
92 * {
93 * "inputName": "firstName",
94 * "value": "John",
95 * "values": []
96 * },
97 * {
98 * "inputName": "date",
99 * "value": "2020-04-28",
100 * "values": []
101 * },
102 * {
103 * "inputName": "comment",
104 * "value": "Comment",
105 * "values": []
106 * },
107 * {
108 * "inputName": "address",
109 * "value": "",
110 * "values": [
111 * "Wix Playground, 100 Gansevoort St",
112 * "New York City",
113 * "New York",
114 * "USA",
115 * "NY 10014"
116 * ]
117 * },
118 * {
119 * "inputName": "phone",
120 * "value": "(555) 555-1234",
121 * "values": []
122 * }
123 * ]
124 * }
125 * },
126 * {
127 * "ticketNumber": "FMXC-BZG3-OT041",
128 * "ticketDefinitionId": "9c3dc432-f1a6-408f-82d8-4f64c7ff581b",
129 * "price": {
130 * "amount": "0.00",
131 * "currency": "USD"
132 * },
133 * "archived": false,
134 * "firstName": "Jane",
135 * "lastName": "Doe",
136 * "email": "jane.doe@somedomain.com",
137 * "contactId": "e11af3d4-c205-4d3a-b687-58d4dda78a6c",
138 * "memberId": "62bc4004-548c-46ad-a699-55ef307273e3",
139 * "confirmed": true,
140 * "form": {
141 * "inputValues": [
142 * {
143 * "inputName": "custom",
144 * "value": "Another comment",
145 * "values": []
146 * },
147 * {
148 * "inputName": "email",
149 * "value": "jane.doe@somedomain.com",
150 * "values": []
151 * },
152 * {
153 * "inputName": "lastName",
154 * "value": "Doe",
155 * "values": []
156 * },
157 * {
158 * "inputName": "firstName",
159 * "value": "Jane",
160 * "values": []
161 * },
162 * {
163 * "inputName": "date",
164 * "value": "2020-04-28",
165 * "values": []
166 * },
167 * {
168 * "inputName": "comment",
169 * "value": "Comment",
170 * "values": []
171 * },
172 * {
173 * "inputName": "address",
174 * "value": "",
175 * "values": [
176 * "Wix Playground, 100 Gansevoort St",
177 * "New York City",
178 * "New York",
179 * "USA",
180 * "NY 10014"
181 * ]
182 * },
183 * {
184 * "inputName": "phone",
185 * "value": "(555) 555-1234",
186 * "values": []
187 * }
188 * ]
189 * }
190 * }
191 * ]
192 * }
193 */