You can simply set the Quantity property of the LineItem instance to the desired value. I have to check the code to be sure but I think UpdateLineItemQuantity actually check and set the Quantity based on availability
I think UpdateLineItemQuantity updates the quantity, but _orderRepository does not save it.
Nevermind, if someone suddenly gets this issue, my solution was to not convert ILineItem to LineItem. UpdateLineItemQuantity works with ILineItem, not LineItem..
Actually that's not true. UpdateLineItemQuantity works with both. I checked the code now and it checks if the shipment is Shipment or not and does change the quanitty accordingly. I don't now what you have in GetCartItems, but it supposedly returns a list of LineItem. You can use cart.GetAllLineItems to return a list of ILineItem, and update the quantity directly, without having to call UpdateLineItemQuantity. A rule of thumb is to use the abstraction APIs all the way, not to mix it with the concrete classes.
LineItem quantity will not save, what do i do?
_orderRepository = IOrderRepository