Generating Easy Digital Downloads Discount Codes for AppSumo Marketplace
AppSumo requires unique codes for each sale. Easy Digital Downloads (EDD) has discount codes that we can use, setting the “discount” to 100%. But we need 5000 to 10000 codes, per AppSumo’s instructions. Here’s how to get that.
Download and install the Discount Code Generator EDD add-on.
Navigate to the Discount Codes menu item, and there’s a new “generate codes” button:
On running the discount code generator, I found my server would time out around 1000 codes, so I set the number of codes to be 1000, and changed the name of the discount code each time I ran it e.g “app sumo 1”, “app sumo 2”, etc. This guarantees you don’t end up with duplicate discount codes, as it generates codes like “app-sumo-1-1” through “app-sumo-1-1000”, and then “app-sumo-2-1” through “app-sumo-2-1000”. Don’t forget to set the discount to 100%!
If you want to check for duplicates, use this SQL statement (changing the table names for your database):
SELECT post_title, count(*) no_of_records FROM wp_posts WHERE post_type = 'edd_discount' GROUP BY post_title HAVING count(*) > 1;
If that query returns no records, you do not have any duplicates.
Once you’ve run the discount code generator 5 or 10 times, you should have 5000 to 10000 discount codes. You can check but going to the “Discount codes” page and you should see thousands of active codes:
To export them, go to Downloads > Reports > Export, and look for the “Export Discount Codes in CSV” meta box at the bottom:
The export takes a while, but does work, and generates a csv like:
I opened the csv in Excel, and deleted all of the columns except for the codes. NOTE: the column “code” is what you need to upload to AppSumo, not the name of the discounts.
If you need to export the codes manually from the database, use this SQL statement:
SELECT wp_posts.ID, wp_postmeta.meta_value as "code" FROM wp_posts JOIN wp_postmeta ON wp_postmeta.post_id = wp_posts.ID WHERE wp_posts.post_type = 'edd_discount' AND wp_postmeta.meta_key = '_edd_discount_code'