How To Deliver a Unique Code When Someone Purchases a Product on Shopify
Coupon Carrier supports automatically generating unique, time-sensitive discount codes from your Shopify store. When a code is requested from the Code List, a randomly generated discount code is created in your store based on the settings you provide.
Deliver a unique code when someone purchases a product
This article will show you how to deliver unique codes to your Shopify customers when they buy a specific product in your store. One of the more common use cases for this is to import a list of unique codes into Coupon Carrier, add a product to your Shopify store that allows someone to purchase it, and then receive one of the codes in an email. It’s a way to sell unique discount codes or vouchers.
Here’s what we need to get started:
- Coupon Carrier account (Signup for a trial here)
- Shopify store
- A list of unique codes that you want to send out when someone purchases a product
Import your unique codes
You can add your unique codes to your Coupon Carrier account by creating a new code list under the code lists tab. Add codes by pasting them or from a CSV file.
Configure the code email and trigger
Create a new Code Email configuration by clicking the Create a New Configuration button. Select Code Email and choose to trigger from an app event. Select Shopify as the trigger app and connect to your store. Copy the Webhook URL by clicking on it, we're going to add this to Shopify in the next step.
From your Shopify admin, go to Settings > Notifications. Scroll down to the Webhooks section. Click the Create webhook button. For the Event option, select Order fulfillment. This means a notification will be sent once an order is marked as fulfilled. Paste the webhook URL that you got from Coupon Carrier and click Save. To confirm the connection, click the Send test button from the menu next to the webhook you created. This tells Coupon Carrier which type of webhook event you added.
Back in Coupon Carrier, enable the "Only trigger if the order contains a specific product" option and enter the product ID for which you want to monitor purchases.
You can customize the email with your logo, message, etc., or upload a custom email template for even more customization.
Once you’re happy with the code email content, the next step is to select the code source for this configuration. We’ll use an existing code list we created earlier, which contains the codes we added.
The default in Coupon Carrier allows only one code to be sent to a recipient. For this use case, you might want to allow someone to receive multiple emails if they purchase the product more than once. If so, you’ll need to enable the option to Allow multiple codes to be delivered to the same email address.
Activate and test your configuration
We’re now ready to save and activate the configuration. Once activated, Coupon Carrier will start monitoring all new Shopify orders.
To test this, you can manually create a new order in your Shopify admin and add the product you specified earlier. Once the order is finalized, you should receive an email with a code shortly after.