How to automatically generate unique discount codes for customers?

4 0 1



I am running a special lifetime discount for the first 1000 customers. After purchase, they will receive a thank you email with the code.


I want to be able to generate a unique code for each customer, and have that code added to the thank you email automatically.


Does anyone know of an app that can do this, Or Ir will I need to learn how to code a shopify app?



Replies 2 (2)

Shopify Partner
6275 574 1326

For an app just search the search the apps forum itself, or the app store for your own description terms: generate discount new customer ; then dig. 


There's also researching marketing apps/services, maybe like klaviyo though you often still have to PREGENERATE the codes to attach to the services mailing list to be inserted for each customer in a campaign.


If you have backend development experience see the .dev docs 


If you have or want to learn more simple coding see an app like mechanic for scripting automations, using a type of liquid code,  without having to create a full blown app. Examples 


If you need this type of automation setup then contact me by my email for services.
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.


Tangent , and on pregeneration,

A different process hypothetically is if the customers are pre-existing in which case you could use excel or google-sheets spreadsheet software to generate such codes then import them either again with the api, or an ETL app like ez-exporter or matrixify.


Save time & money ,Ask Questions The Smart Way

Confused? Busy? Get the solution you need

Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to

Shopify Partner
29 0 7

Hi, we use Omnisend as a third party app for our email service and I know for a fact they can auto genrate discount codes in emails.