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.
View the Admin Screen
Right now, it’s just a basic admin screen with one input and a save button.
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:
You can begin making changes to the plugin by first running:
After that, you should just be able to run
Finally, when you’re ready, just use
npm run deploy to run a production build.
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.Notice: Undefined property: WP_Block_Type::$supports in /www/wp-content/plugins/gutenberg/lib/blocks.php on line 241