You've already forked wc-composable-product
Fix product retrieval - remove strict stock check and add meta_query relation
- Removed is_in_stock() requirement to show all purchasable products - Stock status still displayed on frontend, out-of-stock items disabled - Added 'relation' => 'AND' to meta_query for proper multiple condition handling - Should fix "No products available" issue 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -115,6 +115,7 @@ class Product_Type extends \WC_Product {
|
|||||||
|
|
||||||
// Exclude composable products from selection
|
// Exclude composable products from selection
|
||||||
$args['meta_query'] = [
|
$args['meta_query'] = [
|
||||||
|
'relation' => 'AND',
|
||||||
[
|
[
|
||||||
'key' => '_product_type',
|
'key' => '_product_type',
|
||||||
'value' => 'composable',
|
'value' => 'composable',
|
||||||
@@ -174,11 +175,11 @@ class Product_Type extends \WC_Product {
|
|||||||
$variation_ids = $product->get_children();
|
$variation_ids = $product->get_children();
|
||||||
foreach ($variation_ids as $variation_id) {
|
foreach ($variation_ids as $variation_id) {
|
||||||
$variation = wc_get_product($variation_id);
|
$variation = wc_get_product($variation_id);
|
||||||
if ($variation && $variation->is_in_stock() && $variation->is_purchasable()) {
|
if ($variation && $variation->is_purchasable()) {
|
||||||
$products[] = $variation;
|
$products[] = $variation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($product->is_in_stock() && $product->is_purchasable()) {
|
} elseif ($product->is_purchasable()) {
|
||||||
// Simple and other product types
|
// Simple and other product types
|
||||||
$products[] = $product;
|
$products[] = $product;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user