How to generate bulk discount codes in Shopify
Shopify's admin is built to create discount codes one at a time. When you need hundreds of unique, single-use codes for a campaign — and a file you can hand to a partner — here are your options, honestly compared.
What Shopify does natively
Shopify's built-in discounts are excellent for the common case: you open Discounts in your admin, create a code like SUMMER20, choose what it does, and share that one code with everyone. You can set an expiry, a usage limit, and a "one use per customer" restriction, and you can create an automatic discount that needs no code at all.
What the admin is not built to do is generate a large set of different codes in one go. There's no button that says "make me 500 unique codes," and there's no built-in way to export a set of codes to a file. Shopify's own help documentation on discount types walks through creating individual codes but doesn't cover batch generation or CSV export, because those aren't features of the standard admin. That gap is exactly what this guide is about.
Why you'd want a batch of unique codes
A single shared code works until it doesn't. The moment a code needs to be traceable, limited, or handed out on paper, you need many codes rather than one:
- Influencer and affiliate campaigns — each creator gets their own code, so you can see which of them actually drove orders instead of guessing.
- Print inserts and packaging — a unique code printed in each parcel or flyer can't be scraped from a coupon site and blasted across the internet the way one shared code can.
- One code, one order — a giveaway, a refund gesture, or a "sorry about that" credit should be redeemable once, by one person, and then be spent.
- Events and partnerships — hand a conference or a partner a block of codes to distribute, and cap exactly how many can be redeemed.
In every one of these, a single reusable code either leaks or tells you nothing about where sales came from. Unique codes fix both problems at once.
The manual routes, and where they break down
You can get part of the way there by hand, and it's worth knowing where the ceiling is before you spend an afternoon on it.
Creating codes one by one
Fine for five codes. For fifty it's an evening of repetitive clicking, and for five hundred it simply isn't realistic — and you still have no file at the end, only entries scattered through your Discounts list.
The Shopify API or a CSV importer
Shopify's API can create discount codes programmatically, and this is how bulk tools do it under the hood. But driving the API yourself means writing code, generating your own unique strings, handling Shopify's rate limits so requests aren't rejected mid-run, and retrying the ones that fail — otherwise a batch quietly comes out short and you don't find out until a customer complains. It's a real project, not a quick job.
Spreadsheets
A spreadsheet can invent code strings for you, but a spreadsheet can't turn them into working Shopify discounts. You'd still have to get every one of those rows into Shopify somehow — which lands you back at the two routes above.
Generating a batch in a few clicks
A dedicated app removes the manual work. With Stonewren Bulk Discount Codes installed, you open it from your Shopify admin and:
- Choose how many codes you need and what the discount does — a percentage off, a fixed amount off, or free shipping.
- Set the details that matter: an expiry date, a prefix so the batch is recognisable, a usage limit, and whether each code may be used only once per customer.
- Click Generate codes.
The codes are created as real Shopify discounts, so they redeem at checkout exactly like codes you'd make by hand and they show up in your admin's own Discounts section. Large sets run as a background job with live progress, and if Shopify rejects an individual request — a rate limit, a momentary outage — the job retries it rather than dropping the code. A batch never quietly comes up short. You can read the full details in the app documentation.
Exporting your codes to CSV or XLSX
Generating the codes is only half the task; you usually need them out of Shopify so someone else can use them. Open a set and download it as CSV or XLSX. CSV drops straight into an email platform or a mail-merge for print. XLSX opens cleanly in Excel and Google Sheets with no text-import dialog — and, importantly, without long codes being mangled into scientific notation, which is the classic way a coupon list arrives at a print supplier corrupted.
From there you can hand the file to a print run, upload it to your email tool, or split it between partners. If your codes are decided elsewhere — a printed batch, a partner's numbering scheme — you can also paste your own list in and have the app create the matching Shopify discounts, rather than generating fresh ones.
Choosing a good code format
A little thought here saves support headaches later.
| Choice | Why it matters |
|---|---|
| Use a prefix | A marker like VIP- or PRINT- lets you tell an influencer batch from a packaging batch at a glance, in your admin and in your reports. |
| Keep codes random | Unique random codes can't be guessed from one another the way sequential ones (CODE001, CODE002…) can, so nobody works out code number 347 from the two they were given. |
| Avoid ambiguous characters | If a code will be typed off a printed card, steering clear of easily-confused characters cuts down "it says invalid" emails. |
| Set one-use-per-customer | The single most effective guard against a "unique" code being shared and reused across many orders. |
Frequently asked questions
Can Shopify generate bulk discount codes without an app?
Not in the standard admin. You can create codes one at a time, or use Shopify's API to create them programmatically — which means writing and running code yourself. There's no built-in "generate a batch of unique codes" button and no built-in export of a code set to a file.
How many unique codes can I create?
With a bulk tool, from a handful up to very large sets. Bigger sets are created by a background job with progress shown, so you're not left wondering whether it finished.
Can I export the codes to a spreadsheet?
Yes. Export any set as CSV for email and mail-merge tools, or as XLSX for a clean open in Excel and Google Sheets without long codes being corrupted into scientific notation.
Will the generated codes work at checkout like normal discount codes?
Yes. They're created as genuine Shopify discounts, so they redeem exactly like codes you make by hand and appear in your admin's Discounts section alongside them.
Can I make each code usable only once?
Yes — set a usage limit and "one use per customer" when you generate the batch, so a code is spent after it's redeemed and can't be shared around.
Can I import codes I already have?
Yes. If your codes come from a print run or a partner's list, paste them in and the app creates the matching Shopify discounts, rather than generating new ones.
Get started
Stonewren Bulk Discount Codes generates unique code sets, exports them to CSV and XLSX, and imports codes you already hold. Read the documentation or email support@stonewren.dev with a question.