Update Checkout Product Quantity Via Ajax Link

we are redesigning our checkout, and we encounter a problem when updating the current quantity of a product in the checkout section.
We would like to use a link for it. We have used this to delete products from the cart.
Delete Link

Now we would like to use it for updates from the quantity, but unfortunately it does not work properly.


Here is the target php file where I make my request:

// file: app/controllers/frontend/checkout.php 
// Update products quantity in the cart
if ($mode == 'update') {
    if (!empty($_REQUEST['cart_products'])) {
        foreach ($_REQUEST['cart_products'] as $_key => $_data) {
            if (empty($_data['amount']) && !isset($cart['products'][$_key]['extra']['parent'])) {
                fn_delete_cart_product($cart, $_key);
        fn_add_product_to_cart($_REQUEST['cart_products'], $cart, $auth, true);
        fn_save_cart_content($cart, $auth['user_id']);


    fn_set_notification('N', __('notice'), __('text_products_updated_successfully'));

    // Recalculate cart when updating the products
    if (!empty($cart['chosen_shipping'])) {
        $cart['calculate_shipping'] = true;
    $cart['recalculate'] = true;

    $_suffix = ".$_REQUEST[redirect_mode]";

Does anyone have a tip for me on how I can solve this or what I am missing?

Try to use something like


(!) Not tested

Thanks it worked, but unfortunately it did not have the expected effect.
It always adds up the number of products and does not set them.