This post is deprecated. EDD Software Licensing now supports license upgrades and is built in. Use that instead.
Easy Digital Downloads is the #1 ready-made solution available for selling WordPress plugins and themes (and many other types of software and digital products as well). Software Licensing is an add-on for Easy Digital Downloads that lets developers sell license keys with their digital products.
Commonly seen among licensed software, especially WordPress products, is the option to later upgrade a license key. At the current time, however, the Software Licensing add-on does not provide a way for allowing users to sell automatic upgrades to customers (although this is likely a feature we’ll see from Pippin and the guys at EDD at some point). As of now, the most common way to achieve some type of upgrade is to register a specific discount for any customer wishing to upgrade and having them go through the purchase process again. This is less than ideal because the discount has to be created and sent to the customer (both manually) and, by requiring the customer to purchase the product again, a new key is generated, creating more for the customer to manage and potential confusion.
This solution, although far from perfect, gives EDD users a way to offer license upgrades. It uses Gravity Forms to process the payment (via PayPal; requires the PayPal add-on) and, once payment is submitted and the transaction is complete, updates data associated with the license.
Some things to note about this code are:
- It will require a fair amount of modification because it is not “plug and play”. I won’t explain all of the details because the code is intended for developers (because most people using EDD Software Licensing are developers) so I trust it won’t be too difficult to find what needs to changed. However, I added plenty of comments just in case.
- As is, it only works for a dual-license scheme (something like Single and Unlimited, Personal and Developer, etc.). To offer more than one type of upgrade (i.e. Personal → Business or Business → Developer), you will need to add some extra code. For orders with more than one license key, some modification will also be needed because the Purchase History table will show the license type for only the first license in the order.
- The validation and upgrade-processing sections are very important and need to be customized to fit your form and other needs.
- There a few areas you’ll notice that say “genesis” and that’s because they’re for presenting upgrade info to the customer and are specific to the Genesis Framework. If you are not using Genesis, you can take what’s in these Genesis-specific hooks and add it wherever you want.
- It is not perfect. I was curious to know if I could make this work and I did. Once I finished it up, I tweeted about it and had a couple other people take interest so that’s why I’m making it available now.
Additionally, here’s some info about the form I created for processing the upgrades:
- A hidden field for the current user’s ID – populated dynamically with a parameter of “user_id”.
- A hidden field for the license’s payment ID – populated dynamically with a parameter of “payment_id”.
- A hidden field for the license key – populated dynamically with a parameter of “license_key”.
- A hidden field for the license’s post ID – populated dynamically with a parameter of “license_id”.
- A hidden field for the upgrade option name (i.e. “developer) – populated dynamically with a parameter of “upgrade_option”.
- A single-line text field (required and visible to admin only) to store the user’s first name – populated dynamically with a parameter of “first_name”
- A single-line text field (required and visible to admin only) to store the user’s last name – populated dynamically with a parameter of “last_name”
- A hidden product field for the upgrade product – Uses 3 dynamic population parameters: upgrade_license (Product Name), upgrade_price (Product Price) and upgrade_qty (Product Quantity). I also included a default price of $100 but you can change this to the minimum upgrade price for your product (i.e. $49 license to $99 license would be $50).
- A Product Total field – Uses the class “gf_hidden” to remain hidden from the user.
- Finally, you’ll need to set up a PayPal feed for this form. The code below includes dynamically changing the product’s name to “Upgrade License – {license_key}” so, when sent to PayPal, the customer will clearly see that they paying for a license upgrade of their specific license key.
As you can see, none of the form fields are actually visible; they’re just there to hold information. Don’t worry, I included validation measures to make sure that people who know where to look can’t succeed at they’re evil-doings!
If anyone has ideas for improvement on this or if any bugs are found, let me know. Enjoy!
Thomas says
Hello Ren,
I have purchased a EDD starter kit a few months back in Nov 2016. But, for some reason, I didn’t have a chance to use it. I’d like to resale it for the original purchasing price of $180, to you or any of your clients who is in need. Please email me if interested.
Thanks,
Thomas C
Corrado Izzo says
Great Work Ren – Thank you for this.
Ren says
You’re welcome, Corrado! I’m glad you liked it.
Alex says
Hi, Ren. Wanted to give you a huge thanks for this. It’s something I’ve been looking to do for a long time and your solution works brilliantly. I got it working and upgrades have been processed successfully since. It works very smooth and without any bugs. Thank you very much making this available…you’re the man!
Ren says
Hey, Alex. I appreciate the awesome feedback and I’m glad it helped you! 🙂