Dear Dara,
Thank you for explaining the process. I am ready to write the Corvid code and that is where I need help.
As you correctly mentioned, I can use the onNewOrder() function to access the order, however my issue is that the order object has all information about the order, except for the Coupon Code . I have pasted the snippet from https://www.wix. com/corvid/reference/wix-stores-backend/events/onneworder page for your quick reference. See line number 28 (in Orange) in the code below that has the Discount applied, but not the Coupon used.
I would like to see or access something like what I have shown on line number “28.5” in Blue, which is currently missing from the Sale Event Object.
Is there a way I can get the Coupon code?
I thank you again for spending time with me here on this topic.
// Place this code in the events.js file
2 // of your site’s Backend section.
3
4 export function wixStores_onNewOrder ( event ) {
5 let newOrderId = event . orderId ;
6 let totalPrice = event . totals . total ;
7 }
8
9 /* Full event object:
10 {
11 “orderId”: “2cd413bd-ddea-4101-b122-e8b146fec05f”,
12 “number”: “10005”,
13 “dateCreated”: “2018-08-05T12:33:18.938Z”,
14 “buyerInfo”: {
15 “id”: “6g004532-732d-829f-5kf9-f9rk42afpla04m”,
16 “identityType”: “MEMBER”,
17 “email”: “john.doe@somedomain .com”,
18 “firstName”: “John”,
19 “lastName”: “Doe”,
20 “phone”: “5555555555”
21 },
22 “currency”: “USD”,
23 “weightUnit”: “LB”,
24 “totals”: {
25 “subtotal”: 99.99,
26 “shipping”: 4.99,
27 “tax”: 8.87,
28 “discount”: 9.99,
28.5 “couponcode”:“HNY2021”, //note this is missing currently
29 “total”: 103.86,
30 “weight”: 1.37,
31 “quantity”: 2
32 },
33 “paymentStatus”: “PAID”,
34 “fulfillmentStatus”: “FULFILLED”
35 }
36 */