All Collections
How To
How to choose a pattern for your codes
How to choose a pattern for your codes
e.g. [8LN] generates 8 random letters and numbers (e.g. HW2CD9JC), [10N] generates 10 random numbers (e.g. 2273497742)
Traian avatar
Written by Traian
Updated over a week ago

Your codes can contain prefixes, suffixes, random blocks, as well as any other characters as separators.

Random blocks use the following formats: [?LN], [?L], [?N], where ? can be replaced with any number you want.

For example, the pattern [8LN] will generate 8 random letters and numbers, such as HW2CD9JC.

The pattern [10N] will generate 10 random numbers, such as 2273497742.

The pattern [5L] will generate 5 random letters, such as HFRNM.

Aside from random blocks, you can also add other words, or character blocks that you want to be non-random (present in all codes).

For example, lets' say you want to generate a set of 20,000 unique codes that offer 10% off all your products for a Black Friday promo - you could use a pattern such as: BLACKFRIDAY-[8LN]-10OFF

The codes that would be generated from the pattern BLACKFRIDAY-[8LN]-10OFF would all share the prefix BLACKFRIDAY and the suffix 10OFF, with 8 random letters and numbers sandwiched in between.








To make sure your pattern is correct and the codes being generated will actually look how you want them to look like, it can be a good idea to keep an eye on the Preview in the right side-bar and click on See another to see more code examples.

Important Note #1

Please make sure you use enough random letters and/or numbers in your code to cover the total codes you want to generate. For example, if you want to generate 1,000,000 codes using a pattern such as [2LN] will be insufficient because there are only about 900 unique codes which can be generated from that pattern.

If you're unsure what pattern to use, here are our recommendations:

Up to 100,000 codes: [8LN] (or variations such as BF-[8LN] or [8LN]-15OFF)

Up to 1,000,000 codes: [10LN] (or variations such as BF-[10LN] or [10LN]-15OFF)

Up to 20,000,000 codes: [12LN] (or variations such as BF-[12LN] or [12LN]-15OFF)

Important Note #2

While Shopify allows you to use spaces and other special characters in your codes, we recommend limiting yourself to uppercase letters, numbers and dashes to avoid confusing your customers.

Did this answer your question?