Fix licensed variable products showing as sold out (v0.5.11)

- Fixed is_purchasable() method in LicensedVariableProduct to delegate to
  parent WC_Product_Variable instead of checking for price (variable products
  don't have direct prices, only their variations do)
- Fixed getProductClass() filter to accept all 4 WooCommerce parameters
  and use product_id for reliable variation parent detection
- Fallback to global $post when product_id not available for backwards compat

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-27 13:58:07 +01:00
parent db4966caf2
commit 953aa6c8e8
6 changed files with 39 additions and 10 deletions

View File

@@ -50,11 +50,14 @@ class LicensedVariableProduct extends WC_Product_Variable
}
/**
* Licensed products are purchasable
* Licensed variable products are purchasable if the parent check passes
* Variable products don't have a direct price - their variations do
*/
public function is_purchasable(): bool
{
return $this->exists() && $this->get_price() !== '';
// Use the parent WC_Product_Variable logic
// which checks exists() and status, not price
return parent::is_purchasable();
}
/**