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
Option A: Autogenerate a Unique "Thank You" Discount
The easiest way to reward a customer after a purchase is to automatically generate a brand new, unique discount code directly in your Shopify store. This code can be for a future purchase, creating a delightful experience that encourages repeat business.
- Start by creating an Autogenerated Code List for Shopify.
- Configure the discount value (e.g., 10% off) and set a time limit (e.g., expires in 14 days) to create urgency.
Option B: Deliver a Pre-existing Code (for Digital Products)
If you are selling digital products like software licenses or pre-paid gift cards, you can import your codes into a list and have Coupon Carrier deliver one after a specific product is purchased.
You can add your unique codes to your account by creating a new Manual List under the Code Lists tab. Add codes by pasting them or from a CSV file.
Configure the code mail 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.
Take Your E-commerce Automation Further
Now that you're fulfilling digital product sales, consider these other powerful automations:
- Recover Abandoned Carts: Automatically send a unique, time-sensitive discount to win back lost sales.
- Welcome New Subscribers: Convert new signups into customers with an instant welcome offer.