Integrating Easy Digital Downloads Software Licensing Into Your Plugin

computer code on screen
Photo by Markus Spiske on Unsplash

Easy Digital Downloads is a powerful way to allow your users to download products off of your site. I’ve already gone over how to configure software licensing for your WordPress plugin, but many users reported errors or could not figure how to set it up correctly in their plugin.

As a result, I have created a dummy product on a test website that you can all play with. Please note: do not try to kill my server. I’m arguably sane. Don’t get on my bad side 🙂

Let’s get started.

Download the Example Plugin

You can download the example plugin from my GitHub repository. If you find issues or ways to improve it, please leave an issue or PR. I’m assuming since you plan to sell a plugin, you know how to code. With this assumption, I’m picturing a developer reading this article.

Enough of the intro. Here’s the plugin: Easy Digital Downloads Software Licensing Example.

Install the Plugin

Assuming all is well, you should be able to just install the plugin. You’ll see a new menu item under Settings named EDD Software Licensing Example. Please do not install this plugin on a production site as it’s a very basic and rough draft of what is possible with software licensing.

EDD Software Licensing Example
EDD Admin Panel for Options

View the Admin Screen

Right now, it’s just a basic admin screen with one input and a save button.

Easy Digital Downloads Software Licensing Example Interface
Easy Digital Downloads Software Licensing Example Interface

Now here’s where we can get in trouble. I’m going to share a license you can test against. Again, please, please, do not kill my server. The folks over at Flywheel will kill me, and probably send me a nice bill.

Here’s the license key to test: 053e67c8d6f5f98492cf0bcd64ddf863

You should be able to save the license key, check its status, and revoke the license. For privacy concerns, I can see who and which site the license is activated on, so it’s up to you if you want to use this license for testing. I just figured it could be a quick way to test out the plugin and see if you want to incorporate similar functionality.

The Plugin’s Guts

I’m going to let it be an exercise for the reader to examine the folder structure, how I perform the Ajax requests, how I set up WebPack, etc. There’s a lot of moving parts for just a license screen, but maybe (perhaps?) you can build upon it and share it with the world like I have.

I chose Ajax for the license checking simply because I could. You can change it to just using the Settings API if you wish, or keep the Ajax functionality and include other admin elements. It’s totally up to you.

The technologies used in this example plugin are:

  1. Webpack
  2. Axios
  3. blockUI
  4. SASS
  5. jQuery
  6. SWAL Modal

You can begin making changes to the plugin by first running: npm install.

After that, you should just be able to run npm run watch to start the Webpack process of watching the JavaScript and SCSS files.

Finally, when you’re ready, just use npm run deploy to run a production build.

Questions/Comments?

I’ve gone pretty bare on this article. I shared some sample code you can use for Software Licensing. I even shared a license for you to test out the plugin with.

What’s left is for you to dissect the pieces of the plugin and pull in the parts you like (if there are any) and integrate software licensing into your own plugin.

Let’s continue this conversation in the comments below or on GitHub. I will update this article as more comments pour in with basically a FAQ section for this article. Thanks for reading.

Ronald Huereca
Ronald Huereca

Ronald Huereca

Ronald has been part of the WordPress community since 2006, starting off writing and eventually diving into WordPress plugin development and writing tutorials and opinionated pieces.

No stranger to controversy and opinionated takes on tough topics, Ronald writes honestly when he covers a topic.

Leave a Comment