Swapping product to cart - Keep same order

Hey, I’m trying to swap a product I have in the cart using JS and keep the same order.
I’m removing a product by updating its quantity to 0. I’m then adding the other product but it’s always going last (and it’s showing first on the cart).

I’ve tried rendering the items the way I want through renderContent function (on Dawn 8.0 theme) but looks like the cart is getting the results on server side.

Any ideas on how to render the products keeping the order before swapping?