You could make a microflow that is triggered at the right moments (e.g. when you add / remove an item) where you do a retrieve of all the applicable order lines, and then use an aggregate list action to take the sum of the linetotals. You can then use that sum to change the TotalAmount attribute in your order entity.