Send promotion emails with Shopify Orders at random
Watch our Speed Run screencast to learn how to send promotional emails to your Shopify customers after checkout. Without code or installing another app on your store, generate promotional emails at random to build customer loyalty.
Discount codes are a great way to build customer loyalty. Even better, adding a layer of chance adds an element of excitement to the order.
In this episode we show you how to generate promotional emails from your Shopify orders without adding any apps to your store.
You can control how chances each order has of triggering a discount code in an email. Or you can remove this random portion altogether for a post-purchase email message.
Below is the code snippet for the Node.js step to generate a random number. Just create a new Node.js step in Pipedream and replace the scaffolding with this code snippet:
// Random Number generator Node.js step code
export default defineComponent({
props: {
minimum: { type: 'string' },
maximum: { type: 'string' }
},
async run({ steps, $ }) {
const max = parseInt(this.maximum);
const min = parseInt(this.minimum);
return Math.floor(Math.random() * (max - min + 1) + min);
},
})
Then click "Refresh Fields" to generate the inputs to pick the lower and upper limits.
Learn more and get connected!
🔨  Start building at https://pipedream.com
📣  Read our blog https://pipedream.com/blog
💬  Join our community https://pipedream.com/community