Untitled

mail@pastecode.io avatar
unknown
plain_text
10 days ago
474 B
2
Indexable
Never
add_filter('b2bking_minmax_order_total_calculation_basis', function($val){
	$cart = WC()->cart->get_cart();
	$product_id_to_exclude = 1234;
	$product_to_exclude_total = 0;

	foreach ($cart as $cart_item_key => $cart_item) {
		if ($cart_item['product_id'] == $product_id_to_exclude) {
			$product_to_exclude_total += $cart_item['line_total'];
		}
	}

	$value = (WC()->cart->cart_contents_total + WC()->cart->tax_total) - $product_to_exclude_total;

	return $value;
}, 10, 1);
Leave a Comment