Doing a big promotion for your store can be awesome, but also become a nightmare if you want to give everyone a unique coupon code. Giving everyone a the same multi-use coupon code feels less personal and doesn’t give you any control over the usage of it.

Creating a single coupon isn’t that difficult in WooCommerce, but it takes up quite a lot of time if you want to create more. Sure you can do a few (dozen), maybe even speed up the process by using a Duplicate Post plugin to duplicate existing coupons.

Coupon Generator for WooCommerce

Having to create thousands, tens of thousands or even more coupons should definitely be a automated task, not manual labor. This is where the Coupon Generator for WooCommerce plugin comes in. I’ve developed this plugin to allow store owners to easily and effortlessly generate any amount of coupons.

Generating Coupons

This plugin will add a new submenu below the existing ‘Coupons’, giving you the coupon generator page. This page consists out of 3 simple steps (4 if you include the introduction)

Step 1. Coupon Options

This step should be familiar to you, this is where you’re able to set all the coupon options as you’re used to in WooCommerce when creating/updating a existing coupon code.

Be aware that all settings will be applied to the generated coupons, so setting a usage restriction like email won’t be a good idea.

Step 2. Generation Options

The next step is configuring the coupon generation options. This includes the number of coupons you’d like to generate and the formatting of the coupons. 

Step 3. Coupon Generation

After confirming step 2 you won’t have to do much more other then wait until the coupons have been generated.

The coupons are generated in batches of up to 500 coupons at the time. The time it takes to generate your coupons vary mostly from the quantity of coupons and hosting of your site.

While writing this blog post I’ve been running a very quick and simple WooCommerce site on a $5/month DigitalOcean server that has been consistently generating 500 coupons in about half a second. Creating a total of 1,000,000 coupons took approximately 20 minutes.

I’ve optimized the coupon generation process as much as possible to be as efficient as it can be. Spending hours testing and benchmarking which database queries would be the fastest and most efficient. 

Coupon Generate Completed

When the coupon generation has completed you’ll have the export the generated coupons. The export will be available as a text file and will contain the coupon codes only as one per row with no further data. This is again for performance as adding additional data for each row that is all the same (and less likely what is needed), and will add a lot of size to the export.

Giving the Coupon Generator a Quick Try

If you’d like to give the Coupon Generator for WooCommerce a quick dry run I can recommend using Digital Ocean. Before the blog post I literally setup the test server in less then 2 minutes using a WordPress ‘One-click App’ in Digital Ocean (with an existing account).

In case you’re new to Digital Ocean, using my referral link you’ll get a free $50 in credit that can be used within 30 days, which is probably more then enough to generate a billion coupons (if you’re into that)

About the author: Jeroen Sormani is actively building WordPress, WooCommerce and Easy Digital Downloads plugins. Slightly obsessed by writing high quality code.
Follow Jeroen on Twitter


  1. Hi,
    please, I need only 6 digit and 5 digit codes without dash.
    How can I change numbers and letters in coupon code?

    1. Hi,

      The generated coupon code can be modified using the ‘woocommerce_coupon_generator_random_coupon_code’ filter.


Leave a Reply

Your email address will not be published. Required fields are marked *