Hi Marc,
Some time ago - over 2 years, I did start a proof of concept to do just this. There is a lot more that updating a single order item quantity, but most of this would be handled with core Slatwall code.
This partial code should be on old development pc/laptop. I never completed it and would would probably start form scratch if I needed to do the same right now on a site based on the standard Slatwall templates supplied.
As I said above, there is a lot more than just updating an order item quantity via an AJAX call. Think of it as three parts.
One:
Update order item quantity - Attach a JS event focusout() method to all existing cart item quantities on the cart page passing orderItemID and new quantity to a custom cart controller method. First stage of this method would get the oriderItem entity and set the quantity to the new required quantity.
Two:
Update cart to reflect new quantity - In the new custom cart controller method created above, after setting the new quantity perform an update cart. This part is very important to do. It will reprice and update the entire cart, all cart items and apply the new selling price for each item taking into account an the new order item quantity you set. Simple example for this to be done - you may change a quantity that will allow/disallow price modifiers (promotions, quantity breaks, price groups) to one or more order items prices, order fulfilment prices and then the order totals.
Don't worry this is a single line to code to trigger the Slatwall cart update method.
Probably best to let the AJAX request terminate now, this will force the ORM updates to persist all the changes performed above.
Third:
After the AJAX request above has completed, perform a second AJAX request to get the cart - this will return a JSON string with all new values calculated above.
Now in JS you will have to change all relevant page elements with the updated cart values these will mainly be where unit, discounts, extended prices have changed.- including the cart section of page, order summary section for totals that have changed.
---
The actual CF code is very simple - mainly using what is provided within Slatwall. The more time consuming part will be updating page elements based on new cart values.
In my view - probably not worth the effort to build into static templates for this level of feature.
I do know clients think they need this type of feature because they have seen something similar somewhere else, probably a competitors website. I have talked a couple out of this type of thing in the past. If you want this type of dynamic interaction it is far better to build the front end UI from the ground up using a framework like AngularJS, Vue, React or similar.
Happy to help and talk through your solutions with you if you do decide to go down this route. I may even be able to find my old code, but it is far from complete in terms of features or robustness. It was a simple POC.
Regards,
Chris.
.