Selling WordPress Plugins and Themes with SureCart - SureCart

No results found. Try again with different words?

Search must be at least 3 characters.

Selling WordPress Plugins and Themes with SureCart

With our SureCart paid plans, you have the ability to use software licensing to sell premium themes and plugins with SureCart. What’s great about using SureCart is you offload any update checks, downloads and any other resource extensive tasks off your website – we handle this for you.

To get started, we’ve built a WordPress SDK to make it easy to get started.

Installation

Clone the repository in your project.

cd /path/to/your/project/folder
git clone https://github.com/surecart/wordpress-sdk.git licensing

Now include the dependencies in your plugin/theme.

if ( ! class_exists( 'SureCart\Licensing\Client' ) ) {
    require_once __DIR__ . '/licensing/src/Client.php';
}

Include a release.json

Add a release.json file to the root of your plugin or theme project.
release.json requires the following:

PropertyDescription
nameYour plugin or theme display name.
slugYour plugin or theme slug. IMPORTANT This must match the folder name of your project.
authorHTML to be used for the author of the plugin.
author_profileA url to your author profile.
versionThe version of your plugin or theme.
requiresThe required WordPress version.
testedThe version of WordPress the plugin has been tested with.
requires_phpThe required php version.
sectionsAn array of sections to tab through in the update UI.

Sections will require a changelog property with an html string of your changelog.

release.json example
{
  "name": "SureCart Example Plugin",
  "slug": "surecart-plugin-example",
  "author": "<a href='https://surecart.com'>SureCart</a>",
  "author_profile": "https://surecart.com",
  "version": "0.9.0",
  "requires": "5.6",
  "tested": "6.1.0",
  "requires_php": "5.3",
  "sections": {
    "description": "This is my plugin description.",
    "changelog": "<h4>1.0 –  July 20, 2022</h4><ul><li>Bug fixes.</li><li>Initital release.</li></ul>",
    "frequently asked questions": "<h4>Question<h4><p>Answer</p>"
  }
}

Usage Example

Please refer to the installation step before start using the class.

if ( ! class_exists( 'SureCart\Licensing\Client' ) ) {
    require_once __DIR__ . '/licensing/src/Client.php';
}

// initialize client with your plugin name.
$client = new \SureCart\Licensing\Client( 'Your Plugin', __FILE__ );

// set your textdomain.
$client->set_textdomain( 'your-textdomain' );

// add the pre-built license settings page.
$client->settings()->add_page( 
    [
    'type'                 => 'submenu', // Can be: menu, options, submenu.
    'parent_slug'          => 'your-plugin-menu-slug', // add your plugin menu slug.
    'page_title'           => 'Manage License',
    'menu_title'           => 'Manage License',
    'capability'           => 'manage_options',
    'menu_slug'            => $this->client->slug . '-manage-license',
    'icon_url'             => '',
    'position'             => null,
    'parent_slug'          => '',
    'activated_redirect'   => admin_url( 'admin.php?page=my-plugin-page' ), // should you want to redirect on activation of license.
    'deactivated_redirect' => admin_url( 'admin.php?page=my-plugin-deactivation-page' ), // should you want to redirect on detactivation of license.
    ] 
);

Make sure you call this function directly, never use any action hook to call this function.

For plugins example code that needs to be used on your main plugin file.
For themes example code that needs to be used on your themes functions.php file.

More Usage

$client = new \SureCart\Licensing\Client(  'Twenty Twelve', __FILE__ );

Set textdomain

You may set your own textdomain to translate text.

$client->set_textdomain( 'your-project-textdomain' );

Was this article helpful?


Did not find a solution? We are here to help you succeed.

Try SureCart today

And experience the better way to sell on your website

30-Day money-back guarantee
24/7 world class support team
Safe & secure online payment

Remind me about SureCart HUGE Black Friday Sale

Scroll to Top