diff --git a/functions/routes/ecom/webhook.js b/functions/routes/ecom/webhook.js index 7ad1048..dc2e239 100644 --- a/functions/routes/ecom/webhook.js +++ b/functions/routes/ecom/webhook.js @@ -154,9 +154,9 @@ exports.post = async ({ appSdk, admin }, req, res) => { }) }) } else if ( - trigger.resource === 'orders' && trigger.body.status && + trigger.resource === 'orders' && trigger.body && trigger.body.status && trigger.body.status !== 'cancelled' && trigger.action !== 'create' && - trigger.fields.includes('items') + trigger.fields?.includes('items') ) { console.log('>> ', JSON.stringify(trigger)) // When the original order is edited