How do I execute the onNewOrder function?

I created a new Backend file and added the following:

console.log('New order file');

export function wixStores_onNewOrder(event) {
  console.log(event);
  let newOrderId = event.orderId;
  let totalPrice = event.totals.total;
}

I don’t see anything show up in the console. How do I get this file to load and the code to execute?

1 Like

It should be placed in the events.js not a regular backend file (check doc)

Hey , i put it in events.js , but what i can see this is exported function , should i call it somewhere?