You've already forked wc-composable-product
v1.2.0 - Fix product selection, cart pricing, admin tabs + CI/CD
Fix three critical bugs that persisted through v1.1.11-v1.1.14: - Product selection always empty: meta_query checked _product_type in postmeta, but WooCommerce uses the product_type taxonomy. Replaced with correct tax_query using NOT IN operator. - Cart price always 0.00: composable_price_calculated flag persisted in session, preventing recalculation on page loads. Removed flag; static variable already handles per-request dedup. - Admin tabs both visible on load: JS now triggers WooCommerce native tab click instead of manually toggling panel visibility. Add Gitea CI/CD release workflow triggered on v* tags. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -200,7 +200,7 @@ class Cart_Handler {
|
||||
return;
|
||||
}
|
||||
|
||||
// Use static flag to prevent multiple executions
|
||||
// Use static flag to prevent multiple executions within the same request
|
||||
static $already_calculated = false;
|
||||
if ($already_calculated) {
|
||||
return;
|
||||
@@ -208,13 +208,10 @@ class Cart_Handler {
|
||||
|
||||
foreach ($cart->get_cart() as $cart_item_key => $cart_item) {
|
||||
if (isset($cart_item['data']) && $cart_item['data']->get_type() === 'composable') {
|
||||
if (isset($cart_item['composable_products']) && !isset($cart_item['composable_price_calculated'])) {
|
||||
if (isset($cart_item['composable_products'])) {
|
||||
$product = $cart_item['data'];
|
||||
$price = $product->calculate_composed_price($cart_item['composable_products']);
|
||||
$cart_item['data']->set_price($price);
|
||||
|
||||
// Mark as calculated to prevent re-calculation by other plugins
|
||||
$cart->cart_contents[$cart_item_key]['composable_price_calculated'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user