Created
December 14, 2023 12:46
-
-
Save cloudhooks/73bc78ea20153fd70454f8057db4755a to your computer and use it in GitHub Desktop.
Use this hook to find out when some customer support is needed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = async (refund, actions, { shopUrl }) => { | |
// Adjust these variables to customize | |
const refundMinimum = 0 | |
const to = '[Your email address]' | |
const subject = `(${shopUrl}) Refund requested` | |
const body = ` | |
Please review the following refund: | |
${refund.order_id} | |
` | |
const totalRefundAmount = refund.refund_line_items.reduce((total, item) => { | |
return total + parseInt(item.subtotal) | |
}, 0) | |
if (totalRefundAmount > refundMinimum) { | |
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