Use this hook as a reminder to personally thank a customer who has made a big purchase. The customer will also be tagged so that you can keep track of and build stronger relationships with your best customers.
The minimumPurchase variable is useful for setting a dollar amount, over which, you want to be notified about the order.
module.exports = async (order, actions, { shopifyDomain }) => {
// Adjust these variables to customize
const minimumPurchase = 100 // in dollars
const tag = 'big-spender'
const to = '[email protected]'
const subject = `(${shopifyDomain}) Large order created`
const body = `
${order.customer.email} just made a large order of $${order.total_price}.
Maybe you want to thank them personally?
Order: ${order.order_id}
`
if (parseInt(order.total_price) > minimumPurchase) {
await actions.shopify.tagCustomer(order.customer.id, tag)
await actions.email.send({ to, subject, body })
}
}
For more examples, you can visit our Gist page on Github.