Skip to content

Instantly share code, notes, and snippets.

@cloudhooks
Created December 14, 2023 12:44
Show Gist options
  • Save cloudhooks/2a3f27e455151cd28a3bc63d44114fa2 to your computer and use it in GitHub Desktop.
Save cloudhooks/2a3f27e455151cd28a3bc63d44114fa2 to your computer and use it in GitHub Desktop.
Use this hook as a reminder to personally thank a customer who has made a big purchase.
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 })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment