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 Business and Pro plans, you can purchase an add-on for our software licensing platform 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-intensive tasks off your website – we handle this for you.

We’ve built a WordPress SDK to make it easy to get started.

Installing WordPress SDK

Clone the above repository in your project.

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

Now include these dependencies in your plugin/theme.

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

Include a release.json File

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_phpAn array of sections to tab through in the updated UI.
sectionsA URL to your author profile.

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

Example release.json File
{
  "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 section before you start using this 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__ );

Setting textdomain

You may set your own textdomain to translate text.

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

We hope this article helps you. If you have any questions, please don’t hesitate to reach out to our support team. We’re here to help!

Was this article helpful?


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

Start Selling With SureCart Today

Start for Free – No Credit Card Required

Start Selling With SureCart Today

Start for Free – No Credit Card Required

Trusted by Thousands of Businesses
Trusted by Thousands of Businesses
Start for Free. No Credit Card Required
World Class Support Team
Scroll to Top