Discount codes guide

How to create thousands of unique discount codes in Shopify

Generate codes

Pick a safe format

Single-use codes should be hard to guess. With 8 random characters from 31 letters and numbers there are over 850 billion possibilities, so nobody will stumble onto a valid code.

  • Use a short prefix so staff recognize the campaign, e.g. VIP- or BF26-.
  • Leave out 0, O, 1, I and L. Printed codes are easier to type.
  • Add a dash every 4 characters for readability: VIP-7KQ4-M2XD.
  • Stick to letters, numbers and dashes. Shopify suggests avoiding special characters so codes work in checkout links.

Make each code single use

Set the discount’s total usage limit to 1. Shopify’s API reference describes usageLimit as “the maximum number of times that each code can be redeemed, counted across all customers”, so each code works once. Add “one use per customer” if a customer shouldn’t use two different codes. Test with two codes before a big send.

Limits to know

  • 250 codes per discountRedeemCodeBulkAdd call.
  • 20,000,000 unique discount codes per store in total.
  • 255 characters per code.

More guides

Sources: discountRedeemCodeBulkAdd, Shopify CLI store execute, Shopify Help Center: discount codes. Not affiliated with, endorsed by, or sponsored by Shopify Inc. Shopify is a trademark of Shopify Inc.