I need to add a variable discount to an order. To do that I first insert the order with the bought products using “OrderService.placeOrder”
and then I add an OrderItem (the discount), of type 11 = Special: Order Total, to the order using “DataService.add”. The discount is correctly added to the order, in fact I find
the discount in the order summary in my dashboard, but the order total is wrong as it is not updated withe the value of the new item.
To fix the order total I have to click on the new item (the discount) in the Order Items and then simply click save in the “Order Item information” form.
In this way the order toal is correctly recalculated.
How can I add a new item to the order and then force the order total recalculation?