Hello,
On Backend=>events.js I created a custom code based on the “CartCompleted” function.
Within this function I retrieve the “event.cartId”:
export function wixStores_onCartCompleted(event) {
let cartId = event.cartId;
}
Inside this function, I tried to run “wixData.query(“Stores/Orders”)” in ordr to get the order data based on the cartId.
I followed the key fields list at:
and wrote the query like this:
export function wixStores_onCartCompleted(event) {
let cartId = event.cartId;
wixData.query(“Stores/Orders”)
.eq(‘cartId’,cartId)
.find()
.then( (results) => {
console.log(results);
}
}
But it returns an error on “Real-Time Errors and Logs” related to the unknown cartId on wixData.query.
Can someone please help me with this?