# Discount Codes Import From File

The **Discount Codes Import from File** feature allows you to bulk import discount codes into your Shopify store using a CSV file. This powerful tool enables you to create multiple discount codes with custom settings, active dates, usage limits, and automatically send them to customers via email.

### When to Use This Feature

* **Bulk Code Creation**: Create hundreds or thousands of discount codes at once
* **Pre-generated Codes**: Import existing discount codes from external systems
* **Customer-Specific Discounts**: Send unique discount codes to specific customers
* **Seasonal Campaigns**: Set up multiple campaigns with different active dates in one import
* **Advanced Requirements**: Configure minimum purchase amounts, quantity limits, and combination rules per code

### Getting Started

#### Step 1: Prepare Your CSV File

Download one of our templates to get started:

* Simple Template - Basic discount codes with dates
* Advanced Template - All available options

{% file src="<https://2895247924-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcsKliv3CuXU7kN4gxX9B%2Fuploads%2FYSguYhZr7puOXmyhl6K3%2Fdiscount_codes_simple_template.csv?alt=media&token=26d2c17c-3f08-4a09-ab45-d2a57db5c1ed>" %}

{% file src="<https://2895247924-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcsKliv3CuXU7kN4gxX9B%2Fuploads%2FvdhCxnE5INFlZTFWi3yE%2Fdiscount_codes_advanced_template.csv?alt=media&token=eb2c9e89-f381-4682-a981-a7dd64a779cf>" %}

#### Step 2: Fill in Your Data

Edit the CSV file with your discount code data. See the **Column Reference** below for details on each field.

#### Step 3: Upload and Import

1. Navigate to **Bulk Operations** → **New Bulk Operation**
2. Select **Discount Codes** tab
3. Click **Import From File**
4. Upload your CSV file
5. Review any validation errors
6. Configure email sending (optional)
7. Click **Import now** or **Schedule** for later

### CSV Column Reference

#### Required Columns

These columns **must** be present in your CSV file:

| Column           | Description                                      | Example               |
| ---------------- | ------------------------------------------------ | --------------------- |
| `title`          | Internal title/description for the discount code | `"Summer Sale 2026"`  |
| `discount_type`  | Type of discount: `fixed` or `percentage`        | `percentage`          |
| `discount_value` | Discount value (dollar amount or percentage)     | `20` (for 20% or $20) |

#### Optional Columns

Add these columns to customize your discount codes:

**Basic Settings**

| Column   | Description                                                | Format                   | Example    |
| -------- | ---------------------------------------------------------- | ------------------------ | ---------- |
| `code`   | Discount code customers will use. If empty, auto-generated | Alphanumeric, 3-20 chars | `SUMMER20` |
| `prefix` | Prefix for auto-generated codes (only if `code` is empty)  | Max 4 characters         | `FALL`     |

**Date & Time**

| Column      | Description                      | Format                   | Example      |
| ----------- | -------------------------------- | ------------------------ | ------------ |
| `starts_at` | When the discount becomes active | YYYY-MM-DD or DD/MM/YYYY | `2026-06-01` |
| `ends_at`   | When the discount expires        | YYYY-MM-DD or DD/MM/YYYY | `2026-08-31` |

**Supported Date Formats:**

* `YYYY-MM-DD` (recommended): `2026-12-25`
* `DD/MM/YYYY`: `25/12/2026`
* `MM/DD/YYYY`: `12/25/2026`
* `DD-MM-YYYY`: `25-12-2026`
* `MM-DD-YYYY`: `12-25-2026`

**Note:** If your file contains ambiguous dates (like `01/05/2026`), you'll be asked to specify if the first number represents day or month.

**Usage Limits**

| Column              | Description                                           | Format            | Example |
| ------------------- | ----------------------------------------------------- | ----------------- | ------- |
| `usage_limit`       | Total number of times code can be used                | Integer           | `100`   |
| `once_per_customer` | Limit to one use per customer                         | `true` or `false` | `true`  |
| `once_per_order`    | For fixed discounts: apply once per order vs per item | `true` or `false` | `false` |

**Minimum Requirements**

| Column                    | Description                                      | Format         | Example |
| ------------------------- | ------------------------------------------------ | -------------- | ------- |
| `minimum_purchase_amount` | Minimum order amount required (in shop currency) | Decimal number | `50.00` |
| `minimum_quantity`        | Minimum quantity of items required               | Integer        | `5`     |

**Note:** Only one minimum requirement can be set per discount code. If both are provided, `minimum_purchase_amount` takes precedence.

**Purchase Type**

| Column          | Description                  | Format                                | Example    |
| --------------- | ---------------------------- | ------------------------------------- | ---------- |
| `purchase_type` | What the discount applies to | `one-time`, `subscription`, or `both` | `one-time` |

* `one-time` (default): Only one-time purchases
* `subscription`: Only subscription purchases
* `both`: Both one-time and subscription purchases

**Combination Settings**

Control whether this discount can be combined with other discounts:

| Column                             | Description                         | Format            | Example |
| ---------------------------------- | ----------------------------------- | ----------------- | ------- |
| `combines_with_product_discounts`  | Can combine with product discounts  | `true` or `false` | `true`  |
| `combines_with_order_discounts`    | Can combine with order discounts    | `true` or `false` | `false` |
| `combines_with_shipping_discounts` | Can combine with shipping discounts | `true` or `false` | `false` |

**Customer Notification**

| Column        | Description                                | Format              | Example                |
| ------------- | ------------------------------------------ | ------------------- | ---------------------- |
| `email`       | Customer email to send discount code to    | Valid email address | `customer@example.com` |
| `customer_id` | Shopify customer ID (alternative to email) | Numeric ID          | `123456789`            |

**Note:** Email sending must be enabled in the import form. The app will send the discount code to customers listed in the CSV.

### Examples

#### Example 1: Simple Seasonal Discounts

Create basic discount codes with active dates:

```csv
title,discount_type,discount_value,starts_at,ends_at
Summer Sale 2026,percentage,20,2026-06-01,2026-08-31
Fall Discount,fixed,10,2026-09-01,2026-11-30
Winter Special,percentage,25,2026-12-01,2027-02-28
```

#### Example 2: Customer-Specific Discounts

Send unique discount codes to specific customers:

```csv
title,discount_type,discount_value,email,usage_limit,once_per_customer
Welcome Discount,percentage,15,newcustomer@example.com,1,true
VIP Exclusive,fixed,25,vip@example.com,5,false
Loyalty Reward,percentage,10,loyal@example.com,1,true
```

#### Example 3: Advanced Configuration

Full control with minimum requirements and combination rules:

```csv
code,title,discount_type,discount_value,minimum_purchase_amount,once_per_order,combines_with_shipping_discounts,starts_at,ends_at
BULK50,Bulk Order Discount,fixed,50,200,true,false,2026-01-01,2026-12-31
WELCOME15,New Customer Welcome,percentage,15,,,false,2026-01-01,2026-12-31
FREESHIP10,Free Shipping,fixed,10,50,true,true,2026-01-01,2026-06-30
```

### Auto-Generated Codes

If you don't provide a `code` column or leave it empty, the system will automatically generate unique codes for you.

#### Without Prefix

```csv
title,discount_type,discount_value
Flash Sale,percentage,20
```

Generated code example: `AbC123xY`

#### With Prefix

```csv
title,discount_type,discount_value,prefix
Flash Sale,percentage,20,FLASH
```

Generated code example: `FLASHabc123` (prefix + random characters)

**Prefix Rules:**

* Maximum 4 characters
* Only used when `code` column is empty or not provided
* Helps organize and identify discount codes

### Best Practices

#### 1. Test with Small Batches First

Start with a CSV file containing 5-10 discount codes to ensure everything is configured correctly before importing thousands of codes.

#### 2. Use Clear, Descriptive Titles

Titles are internal and help you identify discount codes in your Shopify admin:

* ✅ Good: `"Summer Sale 2026 - 20% Off"`, `"VIP Customer - $50 Off"`
* ❌ Poor: `"Discount 1"`, `"Code ABC"`

#### 3. Set Appropriate Usage Limits

Consider your campaign goals:

* **Single Use**: Set `usage_limit=1` and `once_per_customer=true` for one-time offers
* **Limited Campaign**: Set `usage_limit=500` to cap total uses
* **Unlimited**: Leave `usage_limit` empty for unlimited uses

#### 4. Plan Your Active Dates

* Set `starts_at` in the future to schedule campaigns
* Set `ends_at` to automatically expire codes
* Leave `ends_at` empty for codes that never expire

#### 5. Be Strategic with Combinations

* Enable `combines_with_shipping_discounts=true` for free shipping offers
* Disable all combinations for exclusive offers
* Use `once_per_order=true` for fixed discounts to prevent stacking per item

#### 6. Validate Before Importing

The app will show validation errors before import. Common issues:

* Missing required columns (`title`, `discount_type`, `discount_value`)
* Invalid discount types (must be `fixed` or `percentage`)
* Invalid date formats
* Invalid boolean values (must be `true` or `false`)

### Common Use Cases

#### Use Case 1: Welcome Discount Campaign

Send unique 15% off codes to new customers:

```csv
title,discount_type,discount_value,email,usage_limit,once_per_customer,starts_at
Welcome Discount - John,percentage,15,john@example.com,1,true,2026-01-01
Welcome Discount - Jane,percentage,15,jane@example.com,1,true,2026-01-01
Welcome Discount - Bob,percentage,15,bob@example.com,1,true,2026-01-01
```

#### Use Case 2: Bulk Order Incentives

Encourage larger orders with minimum purchase requirements:

```csv
title,discount_type,discount_value,minimum_purchase_amount,usage_limit,starts_at,ends_at
Bulk 10% Off,percentage,10,100,1000,2026-01-01,2026-12-31
Bulk 15% Off,percentage,15,200,1000,2026-01-01,2026-12-31
Bulk 20% Off,percentage,20,300,1000,2026-01-01,2026-12-31
```

#### Use Case 3: Flash Sale Event

Create time-limited discounts:

```csv
code,title,discount_type,discount_value,usage_limit,once_per_customer,starts_at,ends_at
FLASH24HR,24 Hour Flash Sale,percentage,30,500,true,2026-03-15,2026-03-16
WEEKEND25,Weekend Special,percentage,25,1000,false,2026-03-20,2026-03-22
```

#### Use Case 4: Free Shipping Promotion

Combine fixed discount with shipping discount combination:

```csv
title,discount_type,discount_value,minimum_purchase_amount,combines_with_shipping_discounts,starts_at,ends_at
Free Shipping - $50+,fixed,10,50,true,2026-01-01,2026-06-30
Free Shipping - $100+,fixed,15,100,true,2026-01-01,2026-06-30
```

### Troubleshooting

#### Issue: Import fails with "No file uploaded"

**Solution:** Make sure you've selected a CSV file and the file is not corrupted.

#### Issue: "Row X: title is required"

**Solution:** Every row must have a title. Check that the `title` column is filled in for all rows.

#### Issue: "Row X: discount\_type must be 'fixed' or 'percentage'"

**Solution:** Check the `discount_type` column. Valid values are exactly `fixed` or `percentage` (lowercase).

#### Issue: "Row X: discount\_value must be a number"

**Solution:** Ensure discount\_value contains only numbers (no currency symbols like $ or %).

#### Issue: Dates are interpreted incorrectly

**Solution:** Use the YYYY-MM-DD format (e.g., `2026-12-25`) or specify your date format when prompted.

#### Issue: Codes not sent to customers

**Solution:**

1. Check that "Send discount codes to customers" is enabled in the import form
2. Verify email addresses in the CSV are valid
3. Ensure you've selected an email sender and template

#### Issue: Generated codes are too similar

**Solution:** The system generates random unique codes. If you need specific patterns, provide your own codes in the `code` column.

### Limitations

* **Product/Collection Targeting**: Currently, imported codes apply to all products. For product-specific discounts, use the Bulk Create feature.
* **Customer Eligibility**: Imported codes are available to all customers. Customer segment targeting is not supported via import.
* **Code Format**: Codes must be 3-20 characters, alphanumeric with hyphens and underscores only.

### Additional Resources

* [Discount Codes Bulk Create](https://docs.giftcardfactory.app/bulk-operations/discount-codes-bulk-create) - For creating codes with product/collection targeting
* [Discount Codes Bulk Send](https://docs.giftcardfactory.app/bulk-operations/discount-codes-bulk-send) - For creating and sending codes to customer lists
* [Email Templates](https://docs.giftcardfactory.app/email-templates) - Customize notification emails

### Need Help?

If you have questions or need assistance:

* Check our [FAQ](https://docs.giftcardfactory.app/faq)
* Contact support via email or in-app chat
