How To Deliver a Unique Code When Someone Purchases a Product on Shopify

Coupon Carrier has support for generating unique time-sensitive discount codes automatically 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've provided.

Deliver a unique code when someone purchases a product

This article will show you how you can deliver unique codes to your Shopify customers when buying 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 and then 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 that 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 notification button 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 that you want to monitor purchases for.

Customize the email with your logo, message, etc. For even more customization, you can also upload a custom email template.

Once you’re happy with the code email content, the next step is to select the code source for this configuration. We’ll choose to use an existing code list that we created earlier, which contains the codes that we added.

The default in Coupon Carrier is only to allow 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 the configuration and activate the configuration. Once activated, Coupon Carrier will start to monitor 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.

Still need help? Contact Us Contact Us