> For the complete documentation index, see [llms.txt](https://help.dollarlabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.dollarlabs.io/dollarlabs-ultimate-discounts/unified-discount/bulk-code-generation.md).

# Bulk code generation

Create hundreds of unique codes for one Unified Discount, view and delete them, export them to CSV, or import your own codes from a CSV or Excel file.

A Unified Discount with the **Discount code** method can hold many codes. Every code gives the same discount. Use unique codes for email campaigns, influencers, or codes moved over from another platform.

{% hint style="info" %}
**Save first.** The bulk code tools appear on the right of a **saved** discount that uses **Discount code**. They don't show while you create the discount, and they don't show for automatic discounts. [Reject Codes](https://help.dollarlabs.io/dollarlabs-ultimate-discounts/unified-discount/reject-codes.md) discounts are automatic, so they have no codes.
{% endhint %}

## Create the code discount

1. Open **Create Function** → **Unified Discount** and pick a type, for example **General Discounts**.
2. In **Discount type**, choose **Discount code**. Type the main code in **Discount code**, or click **Generate**.
3. Set up the **Discount** rows as usual. Code discounts have no **Enter discount title** field: checkout shows the code.
4. Under **Maximum discount uses**, choose the limits you need (see [Usage limits](#usage-limits)).
5. Click **Save**. The saved discount opens, with the **Bulk discounts** card on the right.

You can't switch an automatic discount to a code discount after saving. Duplicate it and change the method on the copy.

## The Bulk discounts card

<figure><img src="https://2844543096-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcVBfwy7Yj4tU8TsxkHEr%2Fuploads%2Fgit-blob-2f09438b4933991d63c2890d343b55c259328a1f%2Fbulk-code-generation-01-bulk-card.png?alt=media" alt="The right column of a saved code discount: the Summary card, then the Bulk discounts card with the text 51 codes and a View all button, then three buttons in a row: Add, Export and Import, and an Estimated complexity card below them."><figcaption><p>The Bulk discounts card and its three buttons.</p></figcaption></figure>

| Part                                          | What it does                                                                                              |
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| **Bulk discounts** · *N codes* · **View all** | Shows how many codes the discount has ("Approximately" when Shopify is still counting) and opens the list |
| **Add**                                       | Generates new random codes                                                                                |
| **Export**                                    | Downloads all codes as a CSV file                                                                         |
| **Import**                                    | Adds or deletes codes from a CSV or Excel file                                                            |

While Shopify creates or deletes codes, **Add** shows **Bulk codes running**, and **Export** and **Import** wait. This can take a few minutes for large batches.

## Add codes

1. Click **Add**. The **Add Bulk Codes** window opens with a **Preview** code. Click **↻ Refresh** for another preview.
2. **Number of codes**: how many to create. The default is 100.
3. **Code length**: the number of random characters, from 1 to 50. The default is 8.
4. **Include characters**: tick the kinds to use: **A-Z**, **a-z**, **0-9**, **!@#$%^&**\*. **A-Z**, **a-z** and **0-9** start ticked. At least one must be ticked.
5. **Prefix (optional)**: added to the start of each code, for example `FW-`. **Suffix (optional)**: added to the end.
6. Click **Add Codes** at the bottom right of the window. The app shows **Code generation queued successfully!**

<figure><img src="https://2844543096-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcVBfwy7Yj4tU8TsxkHEr%2Fuploads%2Fgit-blob-1d9fb394a23d282b80348b85fbe906b218b350ee%2Fbulk-code-generation-02-add-modal.png?alt=media" alt="The Add Bulk Codes window: Preview FW-HIV76UKO with a Refresh link, Number of codes 50, Code length 8 with the help text Number of random characters in each code (1-50), Include characters with A-Z and 0-9 ticked and a-z and !@#$%^&#x26;* unticked, Prefix (optional) FW-, Suffix (optional) empty with the placeholder e.g., -2024, and an Add Codes button at the bottom right."><figcaption><p>50 codes of 8 characters, with the prefix FW-.</p></figcaption></figure>

Prefix and suffix are part of each code. To change them later, create new codes and delete the old ones.

## View and delete codes

1. Click **View all**. The **Discount redeem codes** window lists the codes you generated or imported, each with **Used** *N* **times**. The main code of the discount is not in this list.
2. Type in **Search codes...** to find one.
3. Tick codes, then click **Delete** *N* **codes** at the top right.
4. When the discount has more codes than the window shows, click **Load more** at the end of the list. Click **Close** at the bottom when done.

<figure><img src="https://2844543096-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcVBfwy7Yj4tU8TsxkHEr%2Fuploads%2Fgit-blob-b048695bceebf8cccdd09be678d7f41b9ab0ad2a%2Fbulk-code-generation-03-view-all.png?alt=media" alt="The Discount redeem codes window: a Search codes... field, the text Showing 50 codes, a list of codes starting with FW- each showing Used 0 times, two codes ticked with 2 selected in the header and a Delete 2 codes button at the top right, and a Close button at the bottom."><figcaption><p>Search, select and delete codes.</p></figcaption></figure>

## Export codes

Click **Export**. The browser downloads a CSV with the columns **Discount code**, **Usage count**, **Discount ID** and **Created At**. Use it in your email tool, or keep it to delete codes later.

## Import codes

1. Click **Import**. The **Bulk Actions** window opens.
2. Choose **Add Codes** ("Import new codes into this discount.") or **Delete Codes** ("Delete existing codes from this discount.").
3. Click **Download sample CSV** to see the format. To add codes, the file needs a **Discount code** column. To delete codes, it needs a **Discount ID** column: export the codes first to get it.
4. Drop the file on **Upload File**, or click it. The app takes .csv, .xlsx and .xls files.
5. Click **Start Import** (or **Start Delete**). The window shows the progress.

<figure><img src="https://2844543096-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcVBfwy7Yj4tU8TsxkHEr%2Fuploads%2Fgit-blob-f7a91cf87cd3064e842d103792c29a45c9cce078%2Fbulk-code-generation-04-import-modal.png?alt=media" alt="The Bulk Actions window: the text Select an action and upload your CSV/Excel file, two options Add Codes and Delete Codes with Add Codes selected, a Download sample CSV link, an Upload File drop zone with the hint Accepts .csv, .xlsx, .xls, and the buttons Start Import and Cancel."><figcaption><p>Import codes from a file.</p></figcaption></figure>

## Usage limits

The **Maximum discount uses** card sets Shopify's limits for the whole discount:

* **Limit number of times this discount can be used in total** counts every use of every code together.
* **Limit to one use per customer** stops one customer from using the discount twice, with any of its codes.

Shopify has no limit per single code ([Shopify API reference](https://shopify.dev/docs/api/admin-graphql/latest/objects/DiscountCodeApp)).

## Example: 50 welcome codes with the prefix FW-

{% hint style="success" %}
**Example store:** an outdoor apparel store in the US that sends one code per new subscriber.
{% endhint %}

1. Open **Create Function** → **Unified Discount** → **General Discounts**.
2. Choose **Discount code**. **Discount code**: `FW-WELCOME`. Tick **Use internal title**. In **Internal Title**, enter, for example, `Welcome codes`.
3. In **Discount #1 (PRODUCT)**, keep **Percentage** and type `10`. Leave **Targets** on **All (default)**.
4. In **Maximum discount uses**, tick **Limit to one use per customer**.
5. Set the start date to yesterday and click **Save**.
6. On the saved discount, click **Add**. Set **Number of codes** `50`, **Code length** `8`, tick **A-Z** and **0-9** only, **Prefix (optional)** `FW-`. Click **Add Codes**.
7. Wait until **Bulk codes running** changes back to **Add**. Reload the page. Click **View all** to see the codes.

A shopper who enters one of the codes at checkout gets 10% off. The code shows as a tag under the code field and, with the amount, under each discounted item.

<figure><img src="https://2844543096-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcVBfwy7Yj4tU8TsxkHEr%2Fuploads%2Fgit-blob-9ac493ef3ecba98af2a656cca906abc54fe22ab7%2Fbulk-code-generation-05-checkout-code.png?alt=media" alt="Checkout order summary after entering one of the generated FW- codes: the code shows as a tag under the discount field, the same code with the amount, FW-C3O9WWFD (−$3.60), shows under the item, and TOTAL SAVINGS $3.60 under the total."><figcaption><p>A generated code at checkout.</p></figcaption></figure>

## Limits

* Code discounts only, after the first save.
* All codes of one discount give the same saving and share the usage limits.
* A shopper can enter up to 5 product or order codes and 1 shipping code per order ([Shopify Help Center](https://help.shopify.com/en/manual/discounts/discount-combinations)).

## FAQ

**Can each code be used only once?** Shopify has no limit per code. Tick **Limit to one use per customer**, so each customer can use the discount once.

**Can I change the prefix after I generate the codes?** No. Generate new codes with the new prefix and delete the old ones with **View all** or **Import** → **Delete Codes**.

**Can I import codes from another platform?** Yes. Put them in a **Discount code** column of a CSV or Excel file and use **Import** → **Add Codes**.

## Related

* [Reject codes](https://help.dollarlabs.io/dollarlabs-ultimate-discounts/unified-discount/reject-codes.md)
* [Code won't apply](https://help.dollarlabs.io/dollarlabs-ultimate-discounts/troubleshooting-and-faq/code-wont-apply.md)
* [General discounts](https://help.dollarlabs.io/dollarlabs-ultimate-discounts/unified-discount/general-discounts.md)
