Everything was fine about line items in an invoice until now when I found it was not deleting all line items by providing an empty array in the Invoices.LineItems.
New line items are being added, existing line items are being updated or a single or more line items can be deleted as well. However, no changes to line items are made on Xero when passing an empty array in Invoices.LineItems. So how can we delete all the items from an invoice?
I have tested repeatedly by removing one item at a time and it gets deleted. The last item remains all the time.
The following screenshot was taken from Xero API Explorer after trying with a real invoice and a sample payload.