You've already forked wc-licensed-product
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1f676556f2 | |||
| 5f51aafe3b | |||
| 279b0d5dd6 |
17
CHANGELOG.md
17
CHANGELOG.md
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.5.6] - 2026-01-27
|
||||
|
||||
### Fixed
|
||||
|
||||
- License Settings tab now only shows for Licensed Product and Licensed Variable Product types
|
||||
- Previously the tab was visible on all product types due to CSS `!important` override
|
||||
|
||||
### Changed
|
||||
|
||||
- Improved JavaScript for License Settings tab visibility handling on product type change
|
||||
- Updated README.md with complete feature documentation for v0.5.x features:
|
||||
- Variable Licensed Products
|
||||
- Multi-Domain Licensing
|
||||
- Per-License Customer Secrets
|
||||
- Download Statistics
|
||||
- Configurable Rate Limiting
|
||||
|
||||
## [0.5.5] - 2026-01-26
|
||||
|
||||
### Fixed
|
||||
|
||||
46
README.md
46
README.md
@@ -11,29 +11,34 @@ WC Licensed Product adds a new product type "Licensed Product" to WooCommerce, e
|
||||
### Core Features
|
||||
|
||||
- **Licensed Product Type**: New WooCommerce product type for software sales
|
||||
- **Variable Licensed Products**: Create product variations with different license durations (monthly, yearly, lifetime)
|
||||
- **Automatic License Generation**: License keys generated on order completion (format: XXXX-XXXX-XXXX-XXXX)
|
||||
- **Domain Binding**: Licenses are bound to customer-specified domains
|
||||
- **Multi-Domain Licensing**: Customers can purchase multiple licenses for different domains in a single order
|
||||
- **REST API**: Public endpoints for license validation and management
|
||||
- **Response Signing**: Optional HMAC-SHA256 cryptographic signatures for API responses
|
||||
- **Per-License Secrets**: Each customer receives a unique verification secret for their license
|
||||
- **Version Binding**: Optional binding to major software versions
|
||||
- **Expiration Support**: Set license validity periods or lifetime licenses
|
||||
- **Rate Limiting**: API endpoints protected with rate limiting (30 requests/minute)
|
||||
- **Rate Limiting**: API endpoints protected with configurable rate limiting (default: 30 requests/minute)
|
||||
- **Trusted Proxy Support**: Configurable trusted proxies for accurate rate limiting behind CDNs
|
||||
- **Checkout Blocks**: Full support for WooCommerce Checkout Blocks (default since WC 8.3+)
|
||||
- **Self-Licensing**: The plugin can validate its own license (for commercial distribution)
|
||||
|
||||
### Customer Features
|
||||
|
||||
- **My Account Licenses**: Customers can view their licenses in My Account
|
||||
- **My Account Licenses**: Customers can view their licenses in My Account (grouped by product)
|
||||
- **License Transfers**: Customers can transfer licenses to new domains
|
||||
- **Secure Downloads**: Download purchased software versions with license verification
|
||||
- **Version History**: Access to older versions with collapsible download section
|
||||
- **Copy to Clipboard**: Easy license key copying
|
||||
- **API Verification Secret**: Per-license secret displayed for secure API integration
|
||||
|
||||
### Admin Features
|
||||
|
||||
- **License Management**: Full CRUD interface for license management
|
||||
- **License Dashboard**: Statistics and analytics (WooCommerce > Reports > Licenses)
|
||||
- **Dashboard Widget**: License statistics on WordPress admin dashboard
|
||||
- **Dashboard Widgets**: License statistics and download statistics on WordPress admin dashboard
|
||||
- **Search & Filtering**: Search by license key, domain, status, or product
|
||||
- **Live Search**: AJAX-powered instant search results
|
||||
- **Inline Editing**: Edit license status, expiry, and domain directly in the list
|
||||
@@ -41,10 +46,12 @@ WC Licensed Product adds a new product type "Licensed Product" to WooCommerce, e
|
||||
- **License Transfer**: Transfer licenses to new domains
|
||||
- **CSV Export/Import**: Export and import licenses via CSV
|
||||
- **Order Integration**: View and manage licenses directly from order pages
|
||||
- **Generate Licenses**: Manually generate licenses for admin-created orders
|
||||
- **Expiration Warnings**: Automatic email notifications before license expiration
|
||||
- **Auto-Expire**: Daily cron job automatically expires licenses past their expiration date
|
||||
- **License Testing**: Test licenses against the API directly from admin interface
|
||||
- **Version Management**: Manage multiple versions per product with file attachments
|
||||
- **Download Tracking**: Track download counts per version with statistics widget
|
||||
- **SHA256 Checksums**: File integrity verification with SHA256 hash display
|
||||
- **Global Settings**: Default license settings via WooCommerce settings tab
|
||||
- **WooCommerce HPOS**: Compatible with High-Performance Order Storage
|
||||
@@ -66,13 +73,27 @@ WC Licensed Product adds a new product type "Licensed Product" to WooCommerce, e
|
||||
### Creating a Licensed Product
|
||||
|
||||
1. Go to Products > Add New
|
||||
2. Select "Licensed Product" from the product type dropdown
|
||||
2. Select "Licensed Product" from the product type dropdown (or "Licensed Variable Product" for different license durations)
|
||||
3. Configure the product price in the General tab
|
||||
4. Set license options in the "License Settings" tab:
|
||||
- **Max Activations**: Number of domains allowed per license
|
||||
- **License Validity**: Days until expiration (empty = lifetime)
|
||||
- **Bind to Major Version**: Lock license to current major version
|
||||
|
||||
### Creating Variable Licensed Products
|
||||
|
||||
For selling licenses with different durations (monthly, yearly, lifetime):
|
||||
|
||||
1. Go to Products > Add New
|
||||
2. Select "Licensed Variable Product" from the product type dropdown
|
||||
3. Create variations as you would for any variable product (e.g., by "License Duration")
|
||||
4. For each variation, set:
|
||||
- **Variation Price**: Different prices for different durations
|
||||
- **License Duration (Days)**: Days until expiration (0 = lifetime)
|
||||
- **Max Activations**: Override parent product setting if needed
|
||||
|
||||
Duration labels (Monthly, Yearly, Lifetime) are automatically displayed at checkout.
|
||||
|
||||
### Managing Product Versions
|
||||
|
||||
1. Edit a Licensed Product
|
||||
@@ -84,7 +105,8 @@ WC Licensed Product adds a new product type "Licensed Product" to WooCommerce, e
|
||||
|
||||
1. Go to WooCommerce > Settings > Licensed Products
|
||||
2. Set default values for Max Activations, License Validity, and Version Binding
|
||||
3. Per-product settings override these defaults
|
||||
3. Enable Multi-Domain Licensing to allow multiple licenses per cart item
|
||||
4. Per-product settings override these defaults
|
||||
|
||||
### Customer Checkout
|
||||
|
||||
@@ -144,6 +166,18 @@ define('WC_LICENSE_TRUSTED_PROXIES', 'CLOUDFLARE,10.0.0.1');
|
||||
|
||||
**Note**: Only configure trusted proxies if you actually use them. Without this configuration, rate limiting is more secure against IP spoofing attacks.
|
||||
|
||||
### Configurable Rate Limiting
|
||||
|
||||
The default rate limit is 30 requests per 60 seconds. You can customize this:
|
||||
|
||||
```php
|
||||
// Requests allowed per window (default: 30)
|
||||
define('WC_LICENSE_RATE_LIMIT', 60);
|
||||
|
||||
// Window duration in seconds (default: 60)
|
||||
define('WC_LICENSE_RATE_WINDOW', 120);
|
||||
```
|
||||
|
||||
## REST API
|
||||
|
||||
Full API documentation available in `openapi.json` (OpenAPI 3.1 specification).
|
||||
@@ -173,6 +207,8 @@ openssl rand -hex 32
|
||||
|
||||
The signature prevents man-in-the-middle attacks and ensures response integrity. Use the `magdev/wc-licensed-product-client` Composer package with the `SecureLicenseClient` class to automatically verify signatures.
|
||||
|
||||
**Per-License Customer Secrets**: Each customer receives a unique verification secret derived from their license key. This secret is displayed in their account page under "API Verification Secret" and can be used with the client library instead of sharing the master server secret.
|
||||
|
||||
### Client Libraries & Examples
|
||||
|
||||
**PHP (Recommended):** Install the official client library via Composer:
|
||||
|
||||
@@ -50,9 +50,10 @@ code.file-hash {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* License Product Tab */
|
||||
#woocommerce-product-data .show_if_licensed {
|
||||
display: block !important;
|
||||
/* License Product Tab - Hidden by default, shown via JS based on product type */
|
||||
#woocommerce-product-data .show_if_licensed,
|
||||
#woocommerce-product-data .show_if_licensed-variable {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#woocommerce-product-data .hide_if_licensed {
|
||||
|
||||
@@ -5,7 +5,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WC Licensed Product 0.5.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-01-26 17:06+0100\n"
|
||||
"POT-Creation-Date: 2026-01-27 11:29+0100\n"
|
||||
"PO-Revision-Date: 2026-01-25T18:30:00+00:00\n"
|
||||
"Last-Translator: Marco Graetsch <magdev3.0@gmail.com>\n"
|
||||
"Language-Team: German (Switzerland) <de_CH@li.org>\n"
|
||||
@@ -312,7 +312,7 @@ msgstr "Speichern"
|
||||
#: src/Admin/OrderLicenseController.php:260
|
||||
#: src/Admin/SettingsController.php:192 src/Product/LicensedProductType.php:136
|
||||
#: src/Product/LicensedProductType.php:184
|
||||
#: src/Product/LicensedProductType.php:379
|
||||
#: src/Product/LicensedProductType.php:385
|
||||
#: src/Product/LicensedProductVariation.php:139
|
||||
#: src/Frontend/AccountController.php:286
|
||||
msgid "Lifetime"
|
||||
@@ -1454,7 +1454,7 @@ msgid "License Settings"
|
||||
msgstr "Lizenz-Einstellungen"
|
||||
|
||||
#: src/Product/LicensedProductType.php:135
|
||||
#: src/Product/LicensedProductType.php:378
|
||||
#: src/Product/LicensedProductType.php:384
|
||||
#, php-format
|
||||
msgid "%d days"
|
||||
msgstr "%d Tage"
|
||||
@@ -1469,7 +1469,7 @@ msgid "WooCommerce > Settings > Licensed Products"
|
||||
msgstr "WooCommerce > Einstellungen > Lizensierte Produkte"
|
||||
|
||||
#: src/Product/LicensedProductType.php:154
|
||||
#: src/Product/LicensedProductType.php:396
|
||||
#: src/Product/LicensedProductType.php:402
|
||||
msgid "Max Activations"
|
||||
msgstr "Max. Aktivierungen"
|
||||
|
||||
@@ -1508,27 +1508,27 @@ msgstr "Ja"
|
||||
msgid "No"
|
||||
msgstr "Nein"
|
||||
|
||||
#: src/Product/LicensedProductType.php:321
|
||||
#: src/Product/LicensedProductType.php:327
|
||||
msgid "Version:"
|
||||
msgstr "Version:"
|
||||
|
||||
#: src/Product/LicensedProductType.php:349
|
||||
#: src/Product/LicensedProductType.php:355
|
||||
msgid "Licensed products are always virtual"
|
||||
msgstr "Lizenzierte Produkte sind immer virtuell"
|
||||
|
||||
#: src/Product/LicensedProductType.php:351
|
||||
#: src/Product/LicensedProductType.php:357
|
||||
msgid "Virtual"
|
||||
msgstr "Virtuell"
|
||||
|
||||
#: src/Product/LicensedProductType.php:384
|
||||
#: src/Product/LicensedProductType.php:390
|
||||
msgid "License Duration (Days)"
|
||||
msgstr "Lizenz-Gültigkeit (Tage)"
|
||||
|
||||
#: src/Product/LicensedProductType.php:393
|
||||
#: src/Product/LicensedProductType.php:399
|
||||
msgid "Leave empty for parent default. 0 = Lifetime."
|
||||
msgstr "Leer lassen für übergeordneten Standard. 0 = Lebenslang."
|
||||
|
||||
#: src/Product/LicensedProductType.php:405
|
||||
#: src/Product/LicensedProductType.php:411
|
||||
msgid "Leave empty for parent default."
|
||||
msgstr "Leer lassen für übergeordneten Standard."
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the wc-licensed-product package.
|
||||
# This file is distributed under the same license as the WC Licensed Product package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: wc-licensed-product 0.5.5\n"
|
||||
"Project-Id-Version: WC Licensed Product 0.5.6\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-01-26 17:06+0100\n"
|
||||
"POT-Creation-Date: 2026-01-27 11:29+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -305,7 +305,7 @@ msgstr ""
|
||||
#: src/Admin/OrderLicenseController.php:260
|
||||
#: src/Admin/SettingsController.php:192 src/Product/LicensedProductType.php:136
|
||||
#: src/Product/LicensedProductType.php:184
|
||||
#: src/Product/LicensedProductType.php:379
|
||||
#: src/Product/LicensedProductType.php:385
|
||||
#: src/Product/LicensedProductVariation.php:139
|
||||
#: src/Frontend/AccountController.php:286
|
||||
msgid "Lifetime"
|
||||
@@ -1405,7 +1405,7 @@ msgid "License Settings"
|
||||
msgstr ""
|
||||
|
||||
#: src/Product/LicensedProductType.php:135
|
||||
#: src/Product/LicensedProductType.php:378
|
||||
#: src/Product/LicensedProductType.php:384
|
||||
#, php-format
|
||||
msgid "%d days"
|
||||
msgstr ""
|
||||
@@ -1420,7 +1420,7 @@ msgid "WooCommerce > Settings > Licensed Products"
|
||||
msgstr ""
|
||||
|
||||
#: src/Product/LicensedProductType.php:154
|
||||
#: src/Product/LicensedProductType.php:396
|
||||
#: src/Product/LicensedProductType.php:402
|
||||
msgid "Max Activations"
|
||||
msgstr ""
|
||||
|
||||
@@ -1457,27 +1457,27 @@ msgstr ""
|
||||
msgid "No"
|
||||
msgstr ""
|
||||
|
||||
#: src/Product/LicensedProductType.php:321
|
||||
#: src/Product/LicensedProductType.php:327
|
||||
msgid "Version:"
|
||||
msgstr ""
|
||||
|
||||
#: src/Product/LicensedProductType.php:349
|
||||
#: src/Product/LicensedProductType.php:355
|
||||
msgid "Licensed products are always virtual"
|
||||
msgstr ""
|
||||
|
||||
#: src/Product/LicensedProductType.php:351
|
||||
#: src/Product/LicensedProductType.php:357
|
||||
msgid "Virtual"
|
||||
msgstr ""
|
||||
|
||||
#: src/Product/LicensedProductType.php:384
|
||||
#: src/Product/LicensedProductType.php:390
|
||||
msgid "License Duration (Days)"
|
||||
msgstr ""
|
||||
|
||||
#: src/Product/LicensedProductType.php:393
|
||||
#: src/Product/LicensedProductType.php:399
|
||||
msgid "Leave empty for parent default. 0 = Lifetime."
|
||||
msgstr ""
|
||||
|
||||
#: src/Product/LicensedProductType.php:405
|
||||
#: src/Product/LicensedProductType.php:411
|
||||
msgid "Leave empty for parent default."
|
||||
msgstr ""
|
||||
|
||||
|
||||
BIN
releases/wc-licensed-product-0.5.5.zip
Normal file
BIN
releases/wc-licensed-product-0.5.5.zip
Normal file
Binary file not shown.
1
releases/wc-licensed-product-0.5.5.zip.sha256
Normal file
1
releases/wc-licensed-product-0.5.5.zip.sha256
Normal file
@@ -0,0 +1 @@
|
||||
8c37e1c68eb6031c37d35adc516a492abdbea8498bdc3e3fc7d93eda380a4fe0 wc-licensed-product-0.5.5.zip
|
||||
@@ -202,22 +202,28 @@ final class LicensedProductType
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($) {
|
||||
// Show/hide panels based on product type
|
||||
$('select#product-type').change(function() {
|
||||
if ($(this).val() === 'licensed') {
|
||||
function toggleLicensedProductOptions() {
|
||||
var productType = $('#product-type').val();
|
||||
var isLicensed = productType === 'licensed';
|
||||
var isLicensedVariable = productType === 'licensed-variable';
|
||||
|
||||
if (isLicensed || isLicensedVariable) {
|
||||
$('.show_if_licensed').show();
|
||||
$('.show_if_licensed-variable').show();
|
||||
$('.general_options').show();
|
||||
$('.pricing').show();
|
||||
$('.general_tab').show();
|
||||
} else {
|
||||
$('.show_if_licensed').hide();
|
||||
$('.show_if_licensed-variable').hide();
|
||||
}
|
||||
}).change();
|
||||
}
|
||||
|
||||
// Show general tab for licensed products
|
||||
$('#product-type').on('change', function() {
|
||||
if ($(this).val() === 'licensed') {
|
||||
$('.general_tab').show();
|
||||
}
|
||||
});
|
||||
// Initial state on page load
|
||||
toggleLicensedProductOptions();
|
||||
|
||||
// On product type change
|
||||
$('#product-type').on('change', toggleLicensedProductOptions);
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: WooCommerce Licensed Product
|
||||
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wc-licensed-product
|
||||
* Description: WooCommerce plugin to sell software products using license keys with domain-based validation.
|
||||
* Version: 0.5.5
|
||||
* Version: 0.5.6
|
||||
* Author: Marco Graetsch
|
||||
* Author URI: https://src.bundespruefstelle.ch/magdev
|
||||
* License: GPL-2.0-or-later
|
||||
@@ -28,7 +28,7 @@ if (!defined('ABSPATH')) {
|
||||
}
|
||||
|
||||
// Plugin constants
|
||||
define('WC_LICENSED_PRODUCT_VERSION', '0.5.5');
|
||||
define('WC_LICENSED_PRODUCT_VERSION', '0.5.6');
|
||||
define('WC_LICENSED_PRODUCT_PLUGIN_FILE', __FILE__);
|
||||
define('WC_LICENSED_PRODUCT_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
||||
define('WC_LICENSED_PRODUCT_PLUGIN_URL', plugin_dir_url(__FILE__));
|
||||
|
||||
Reference in New Issue
Block a user