# Bulk Generate Unique Coupon Codes for PrestaShop 8 & 9: documentation

> Overview The module creates batches of unique discount codes that share the same rules. Each code is a native PrestaShop cart rule. Codes are distributed by email, as a printable…

- Page: <https://www.datafirefly.com/en/documentation/bulk-coupon-codes-prestashop/>
- Language: en
- Last updated: 2026-09-24
- Other languages: [fr](https://www.datafirefly.com/documentation/bulk-coupon-codes-prestashop/index.md), [es](https://www.datafirefly.com/es/documentation/bulk-coupon-codes-prestashop/index.md), [de](https://www.datafirefly.com/de/documentation/bulk-coupon-codes-prestashop/index.md), [it](https://www.datafirefly.com/it/documentation/bulk-coupon-codes-prestashop/index.md), [pl](https://www.datafirefly.com/pl/documentation/bulk-coupon-codes-prestashop/index.md), [nl](https://www.datafirefly.com/nl/documentation/bulk-coupon-codes-prestashop/index.md), [pt](https://www.datafirefly.com/pt/documentation/bulk-coupon-codes-prestashop/index.md)
- Index: <https://www.datafirefly.com/en/documentation/llms.txt>

## Overview

The module creates batches of unique discount codes that share the same rules. Each code is a native PrestaShop cart rule. Codes are distributed by email, as a printable PDF with QR codes or through a CSV export, and each batch has its own usage statistics.

## Installation

1. In **Modules > Module Manager**, click **Upload a module** and select `dfbulkcoupons-1.1.0.zip`.
2. Installation adds the **Catalog > Discounts > Bulk coupon codes** tab. The module's **Configure** button also leads there.
3. The module enables the cart rules feature if it was disabled.

Upgrading from 1.0.0: upload the new ZIP over the old one. The upgrade script adds the sending and printing columns and the hook used by direct links, without changing existing batches.

## Create a batch

Click **New batch** and fill in the form from top to bottom.

### Batch

The **batch name** is used in statistics and exports. The **channel** tells where the codes will be distributed (email, newsletter, SMS, social media, influencers, affiliates, print, physical store, customer service, other or a custom name). It is used to compare campaigns in the performance by channel table.

### Code format

A code is made of a prefix, a random part and a suffix. In the random part, `X` is a letter or a digit, `A` a letter and `#` a digit. Other characters, such as dashes, are kept. Example: prefix `SUMMER-` and random part `XXXX-XXXX` give `SUMMER-K7MQ-3HWD`.

The "Easy to read" character set leaves out 0, O, 1, I and L to avoid typing mistakes. At least 4 random characters are required, and the format must offer at least 20 times more combinations than the requested number of codes: the preview and the combination counter show it while you type.

### Recipients and quantity

- **Anonymous codes**: enter the number of codes, from 1 to 200,000. They can be distributed freely.
- **One personal code per customer of selected groups**: one code per active customer of the checked groups, with the "Newsletter subscribers only" option.
- **One personal code per customer from an email list**: paste the addresses, one per line or separated by commas. Addresses without a customer account are skipped and their number is shown.

A personal code only works for the customer account it is assigned to.

### Discount

The name shown to customers appears in the cart and on the invoice, in each language. Types: percentage, fixed amount (tax excluded or included, in one currency), free shipping or free gift (the default combination of the product is offered). A percentage or amount applies to the whole order without shipping or to one specific product. A percentage can also apply to the cheapest product or to the restricted products.

### Validity and usage

Start and end dates, **uses per code** and **uses per customer**: set 1 and 1 for single-use codes. Minimum order amount (with currency, taxes and shipping), priority, "Cannot be combined with other discounts", display of the code in its owner's cart (personal codes only) and immediate activation.

### Restrictions

Restriction by products, categories or brands with a minimum quantity of matching products, allowed customer groups, allowed delivery countries and, in multistore, allowed shops. An empty field adds no restriction.

## Code generation

After you submit the form, the generation page creates the codes in blocks of 250 with a progress bar. Keep the page open. If it is closed, generation resumes where it stopped the next time you open the batch (**Resume** link in the list). Each code is a cart rule whose description starts with `[DFBC#id]`, visible in Catalog > Discounts.

## Batch page

### Statistics

Codes generated, codes used and redemption rate, valid orders, orders from new customers (customers with no earlier valid order), revenue excluding tax and average order, discount granted excluding tax and revenue to discount ratio, codes still usable. Then a chart of uses per day, the 15 most used codes and the latest 30 orders. Only valid orders count toward revenue and discount, converted into the default currency.

### Manage the batch

- **Details**: name, channel and internal note. The new name is copied to the description of the cart rules.
- **End of validity**: applies to every code of the batch.
- **Add codes**: for an anonymous batch, with the same format and rules.
- **Disable or enable all codes**, **delete codes never used**, **duplicate** or **delete** the batch. Past orders keep their discount.

### Code list

The **Browse codes** button lists codes 50 per page, with tabs by status: available, used, fully used, expired, disabled. Search works on the start of the code or the customer email. For each code: copy the code or its direct link, uses, remaining uses, email sent date, last order, enable or disable, and a link to the native cart rule.

## Send the codes by email

Available for batches of personal codes, from the **Distribution** panel of the batch page.

1. For each language, edit the subject and the message. Available variables: `{firstname}`, `{lastname}`, `{code}`, `{discount}`, `{valid_until}`, `{shop_name}`, `{link}`. The email always shows the code in a frame, the discount, the end date and a button that applies the code to the cart.
2. Click **Send me a test email**: it goes to your employee address, in your language, with a code of the batch.
3. Choose the recipients: codes not sent yet (and failed ones), or all codes again as a reminder. The "Only customers who accepted the newsletter" option is checked by default.
4. Set the number of emails per minute to stay under the limit of your mail server or SMTP provider, then click **Save and send**.

Emails go out in chunks of 10 with a progress bar and a pause button. Each customer receives the version in the language of their account. Codes already used, disabled or expired, and deleted or disabled accounts are skipped. Emails refused by the server are listed and retried at the next sending of unsent codes.

Emails use the settings of **Advanced Parameters > E-mail**. If sending is disabled there, a warning is shown at the top of the page.

## Print the codes

The **Print the codes** button generates an A4 PDF:

- **Cards**: 10 per page (95 x 55 mm), with cut lines.
- **Labels**: 21 per sheet (63.5 x 38.1 mm, common 3 x 7 sheets).
- **Flyers**: 4 per page in A6 format, with cut lines.

Choose the codes (unused codes never printed, all unused codes or all codes), how many (up to 2,000 per file) and how many to skip at the start. Set the headline, the conditions (variables `{valid_until}`, `{shop_name}`, `{customer}`), the accent color, the QR code, the shop name and, for personal codes, the customer name. The "Mark these codes as printed" option prevents printing the same codes twice.

## Direct link and QR code

Each code has a URL such as `https://your-shop.com/module/dfbulkcoupons/apply?code=CODE`. It opens the shop and applies the code to the cart. If the visitor has no cart yet, or the cart does not meet the conditions (minimum amount, products, owner's account), the code is kept for 30 days in the visitor's cookie and applied as soon as the cart meets them. This link is behind the printed QR codes, on the email button, in the code list and in the CSV export.

## CSV exports

Files are UTF-8 with a semicolon separator and open directly in Excel.

- **Codes** (all, unused or used): code, status, uses, remaining uses, validity dates, customer email, first and last name, last use, last order, email sent date, printed date, direct link.
- **Usage by order**: date, ID, reference and status of the order, valid order or not, code, customer, discount and total with and without tax, currency.

## Performance by channel

As soon as several channels are used, the batch list shows a table per channel: number of batches and codes, codes used, rate, orders, revenue and discount excluding tax, sorted by revenue.

## Uninstalling

Uninstalling deletes the module tables (batches, sending and printing history). Codes already generated remain active cart rules in Catalog > Discounts.

## Troubleshooting

- **Generation stops**: open the batch again and generation resumes. A precise error message is shown if the database refuses the inserts.
- **"This format leaves too few combinations"**: add random characters or switch to the full alphabet.
- **Failed emails**: check Advanced Parameters > E-mail with a test email, then send the unsent codes again.
- **The QR code does not reduce the cart**: open the cart, the code is applied as soon as its conditions are met. For a personal code, the customer must be logged into their account.
