Updating order items doesn't update order total

This issue may sound a little similar to Order total is not updated after a new item is added by API but instead of just adding a new order item, I want to UPDATE/EDIT an existing order item, and have the order’s total also be updated.
But right now, when I update an order item, I can see it’s successfully being updated, but the order’s total remains unchanged.

E.g., I start off with an order like this: https://s.nimbus.everhelper.me/share/1139832/1ws144ysrmx0l0uv0133
Then I add an order item (the “Percent discount affect tax” line) AND I also update the “TPS” item to be $0.25 instead of $0.50, but the order’s total isn’t updated; see https://s.nimbus.everhelper.me/share/1139838/z6eb2l0lw7ukno4q7u5g. 10 + 0.25 - 4 = 10.25, not 10.50.

For context, this happens when people initially create an order in our system, but then later use a promotion code that should also reduce the tax “TPS”.

I’m updating the order item using the PHP xml rpc library, using “DataService.update” on the “OrderItem” table.

I also tried updating the corresponding InvoiceItem but that didn’t change the order’s total, either. I tried updating the invoice’s total directly, but it’s read-only. I tried to delete the order item and then re-add it, but Infusionsoft has an error if you try to delete an order item.

It seems my only option is to totally delete the order and create a new one. Is that correct?

After updating both the OrderItem and the InvoiceItem, you can call addPaymentPlan to force the InvoiceTotal to recalculate from the InvoiceItem data.

If anyone knows a more direct fix for this - please post it.

1 Like

thanks @Jordan_Novak, that mostly works.
Of course, now there is an extra payment plan item with the old amount on it, see https://s.nimbus.everhelper.me/share/1144635/eo1xun5agvhd215chz7a. I can’t help but think our users are going to wonder about that and what it means.

I added a payment plan with autocharge off, with card ID 0, merchant account ID 0, 0 days until retry, max of 0 retries, an initial payment of 0, the same initial payment date as the original invoice, and set the plan to start with that same date, 0 payments, and 1 day between payments (could have set it to 0 too, maybe).

I found recalculating taxes also updates the total (but of course overwrites what I set for the tax with what Infusionsoft thinks the tax should be, which creates a discrepancy between our system and Infusionsoft, which I suppose we could resolve by updating our data with what’s in Infusionsoft but that’s tricky too…). But if I send taxes to Infusionsoft, but mark them as a different type than “tax” (e.g., if I mark them as “Service and Misc”) then that doesn’t happen (but of course, users may think it strange tax items don’t appear as taxes…)