You've already forked wc-licensed-product
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:
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user