=== Ultimate WooCommerce Licenses Manager ===
Contributors: gbusinge
Tags: woocommerce, licenses, license manager, software, licensing, api, software updates
Requires at least: 5.5
Tested up to: 6.5
Stable tag: 1.1.0
Requires PHP: 8.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
WC requires at least: 7.0
WC tested up to: 8.5

The ultimate solution for selling and managing software licenses, product versions, and automatic updates through your WooCommerce store.

== Description ==

Ultimate WooCommerce Licenses Manager turns your WooCommerce store into a professional software licensing hub. Whether you sell WordPress plugins, themes, or any other software, this plugin gives you the power to:

Generate License Keys: Automatically create unique license keys when a product is purchased.

Manage Licenses: Manually add, edit, or delete license keys from a central admin panel.

Control Activations: Set a maximum number of site activations for each license (e.g., 1 site, 5 sites, unlimited).

Set Expirations: Sell licenses that are valid for a number of days (e.g., 365) or for a lifetime.

REST API: A secure, built-in REST API to handle license activation, deactivation, and validation from your software.

Software Updates: Upload your plugin/theme .zip files directly to the product page.

Automatic Updates: Securely deliver automatic update notifications to your customers' WordPress dashboards, just like professional plugins.

My Account Integration: Customers can view their keys and manage their active sites directly from their "My Account" page.

Freemium Model: Use the plugin for free for 1 product, and upgrade to Pro to manage unlimited products!

== Installation ==

Upload the ultimate-woocommerce-licenses-manager folder to your /wp-content/plugins/ directory.

Activate the plugin through the 'Plugins' menu in WordPress.

Go to the "License Manager" > "Settings" menu in your WordPress admin.

Generate your API Keys in the "API Settings" tab. These are for your own use.

If you purchased the Pro version, go to the "Upgrade to Pro" tab, enter your license key, and click "Activate".

== Frequently Asked Questions ==

How do I create a licensed product?

Go to "Products" > "Edit Product".

In the "Product data" box, click the "License Manager" tab.

Check the box "This product grants a license".

Set the "Max Activations" (e.g., 1 for a single site).

Set the "Validity (days)" (e.g., 365 for one year, or 0 for lifetime).

How do I sell different license tiers (1 site, 5 sites)?

This is the best way to sell tiered licenses!

Create a new product and set its type to "Variable product".

Go to the "Attributes" tab. Add an attribute named "License" with values like 1 Site | 5 Sites | 15 Sites. Check "Used for variations".

Go to the "Variations" tab. Create variations from your attributes.

For each variation ("1 Site", "5 Sites", etc.):

Set its unique price.

Check "This variation grants a license".

Set the "Max Activations" to 1, 5, or 15 to match the variation.

How do I activate the Pro version of this plugin?

Purchase a Pro license from our store.

Go to "License Manager" > "Settings" in your WordPress admin.

Click the "Upgrade to Pro" tab.

Paste your license key into the field and click "Activate License".

You can now create unlimited licensed products!

How do I set up automatic updates for my customers?

This is a powerful two-part process.

Part 1: On Your Store (As the Seller)

Go to the product you are selling (e.g., "My Awesome Plugin").

Click the "License Manager" tab.

Fill in the "Current Version" (e.g., 1.0.1). This must match the version in your plugin file.

Fill in the "Changelog" with details about the new version.

Use the "Upload Product File" field to upload the .zip file for your new version (e.g., my-awesome-plugin-1.0.1.zip).

Click "Update" to save the product.

Part 2: In Your Customer's Plugin (The Code)

You need to add our updater script to the plugin/theme you are selling.

Find the updater-snippet.php file inside this plugin's folder (/admin/updater-snippet.php).

Copy that file into your plugin's folder (e.g., /my-awesome-plugin/updater-snippet.php).

In your plugin's main PHP file (e.g., my-awesome-plugin.php), add these lines:

// Load the updater class
require_once( plugin_dir_path( __FILE__ ) . 'updater-snippet.php' );

function my_awesome_plugin_init_updater() {
    // Get the license key the user saved in *your* plugin's settings
    $license_key = get_option('my_plugin_license_key', '');

    new UWLM_Client_Updater(
        '[https://YOUR-STORE-URL.com](https://YOUR-STORE-URL.com)',  // <-- REPLACE with your store's homepage URL
        __FILE__,                     // <-- This is your plugin's main file
        array(
            'version'    => '1.0.0', // <-- The CURRENT version of your plugin
            'license'    => $license_key,
            'product_id' => '12345', // <-- The WooCommerce Product ID from YOUR store
            'slug'       => 'my-awesome-plugin' // <-- Your plugin's slug
        )
    );
}
add_action( 'plugins_loaded', 'my_awesome_plugin_init_updater' );


That's it! You must provide a settings page in your plugin where your customer can save their my_plugin_license_key. The script will then handle the rest. When you upload a new version, your customers will see the "Update" notification in their dashboard.

== Changelog ==

= 1.1.0 =

ADD: Software auto-updates! Upload files to products and deliver updates to clients.

ADD: Client-side updater snippet for customers.

ADD: Secure /download API endpoint.

FIX: Critical error on product data tab.

ADD: "Add License Key" admin page for manual key creation.

ADD: Free vs. Pro logic (1 product limit for free).

ADD: Pro activation settings tab.

ADD: "View Activations" in the admin license table.

FIX: Ensure WooCommerce product select loads on "Add New" page.

= 1.0.1 =

FIX: Add WooCommerce HPOS (High-Performance Order Storage) compatibility.

FIX: Update order link in admin table to be HPOS-compatible.

= 1.0.0 =

Initial release.