To further describe the issue, I have attached here the exact server error log: https://tppr.me/CCnth
Have error 500 if in cart have more products if have one is okay.
Fix IT with this!
<script type="text/javascript">
$("form.checkout").on("change", "input.qty", function () {
$.ajax({
url: '\/wp-admin\/admin-ajax.php',
data: {
action: 'cqoc_update_order_review',
security: wc_checkout_params.update_order_review_nonce,
post_data: $('form.checkout').serialize()
},
type: 'post',
success: function (response) {
console.log(response);
$('body').trigger('update_checkout');
}
});
});
</script>
function cqoc_update_order_review() {
$values = array();
parse_str($_POST['post_data'], $values);
$cart = $values['cart'];
print_r($cart);
$cart_updated = false;
foreach ($cart as $cart_item_key => $cart_value) {
$passed_validation = apply_filters('woocommerce_update_cart_validation', true, $cart_item_key, $values, $quantity);
if ($passed_validation) {
WC()->cart->set_quantity($cart_item_key, $cart_value['qty'], false);
$cart_updated = true;
}
// woocommerce_cart_totals();
}
// Trigger action - let 3rd parties update the cart if they need to and update the $cart_updated variable.
$cart_updated = apply_filters('woocommerce_update_cart_action_cart_updated', $cart_updated);
if ($cart_updated) {
WC()->cart->calculate_totals();
}
exit;
}
I’m glad to know that you are able to fix the issue & sharing the solution.
I have many users who have multiple products in the cart and it works without any issues.
I have also checked with multiple products in the cart and it works.
Of course , may be i have many Plugins or many change in function,just this is my solution for my problem.
Best regards!
The issue is solved hence marking it as resolved.