From 20fb39d1a1079189b5841f57cc9c30cdbb4d9732 Mon Sep 17 00:00:00 2001 From: magdev Date: Tue, 27 Jan 2026 13:59:00 +0100 Subject: [PATCH] Update CLAUDE.md with v0.5.8-0.5.11 session history Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index f18a10e..cf31659 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1495,3 +1495,51 @@ Removed redundant "Default" prefix from setting labels on the Default Settings p - Created release package: `releases/wc-licensed-product-0.5.7.zip` (856 KB) - SHA256: `ceb4d57598f576f4f172153ff80df8c180ecd4dca873cf109327fc5ac718930f` - Tagged as `v0.5.7` and pushed to `main` branch + +### 2026-01-27 - Version 0.5.8-0.5.11 - Licensed Variable Product Fixes + +**Overview:** + +Series of bug fixes for licensed variable products that were showing frontend errors and not displaying properly. + +**v0.5.8 - Initial Fix:** + +- Fixed critical error on frontend product pages for licensed variable products +- Variable product add-to-cart template now passes required variables (`available_variations`, `attributes`, `selected_attributes`) +- Added JavaScript event listeners for WooCommerce AJAX events to maintain admin variants tab visibility + +**v0.5.9 - Null Checks:** + +- Added null checks for `get_variation_attributes()`, `get_available_variations()`, and `get_default_attributes()` +- Show informative message instead of error when product has no variations configured +- Changed product type check from `instanceof` to `is_type()` for better compatibility + +**v0.5.10 - Product Loading:** + +- Re-load product via `wc_get_product()` to ensure correct class instance is used +- Removed overly strict type check that was preventing variations from displaying + +**v0.5.11 - Final Fix:** + +- **CRITICAL:** Fixed "sold out" message on licensed variable products +- `LicensedVariableProduct::is_purchasable()` now delegates to parent `WC_Product_Variable` class (variable products don't have direct prices - only variations do) +- Fixed `getProductClass()` filter to accept all 4 WooCommerce parameters and use product_id for reliable variation parent detection +- Added fallback to global `$post` when product_id not available + +**Modified files:** + +- `src/Product/LicensedProductType.php` - Fixed `variableAddToCartTemplate()` and `getProductClass()` methods +- `src/Product/LicensedVariableProduct.php` - Fixed `is_purchasable()` method +- `wc-licensed-product.php` - Version bumps + +**Technical notes:** + +- WooCommerce `woocommerce_product_class` filter has 4 parameters: `$className`, `$productType`, `$postType`, `$productId` +- Variable products delegate purchasability to their variations - checking `get_price()` on parent is incorrect +- Variation parent detection must use product ID, not global `$post` which may not be set on frontend + +**Release v0.5.11:** + +- Created release package: `releases/wc-licensed-product-0.5.11.zip` (857 KB) +- SHA256: `32571178bfa8f0d0a03ed05b498d5f9b3c860104393a96732e86a03b6de298d2` +- Committed to `dev` branch