I am trying to use onNewOrder(), however, after I checkout and purchase items from my website, no console logs appear. Nothing happens when I try to trigger onCartCreated() either. I have tested this in both the test website mode and after publishing my changes.
Below is my code in events.js. Thanks!
import wixData from 'wix-data';
import wixStores from 'wix-stores-backend';
export function wixStores_onCartCreated(event) {
console.log(event);
let total = event.totals.total;
}
export function wixStores_onNewOrder(event) {
console.log(event);
// Get the new order's line items from the Stores/Orders collection
const orderLineItems = wixData.get("Stores/Orders", newOrderId)
.then((results) => {
return results.lineItems
})
.catch((error) => {
// Order not found in the Stores/Orders collection
console.error(error);
});
}