Fix License Settings tab visibility and update README (v0.5.6)

- License Settings tab now only shows for licensed and licensed-variable product types
- Fixed CSS that forced show_if_licensed to always display
- Improved JavaScript for proper tab show/hide on product type change
- Updated README.md with complete v0.5.x feature documentation:
  - Variable Licensed Products
  - Multi-Domain Licensing
  - Per-License Customer Secrets
  - Download Statistics
  - Configurable Rate Limiting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-27 11:29:56 +01:00
parent 279b0d5dd6
commit 5f51aafe3b
5 changed files with 79 additions and 19 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -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 {

View File

@@ -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

View File

@@ -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__));