New Aggregate formula fields not calculating when a Sales Order is created via API
I have connected WooCommerce to Zoho via a plugin which uses Zoho API to sync Orders in WooCommerce to create/update a Sales Order in Zoho.
The problem with the default layout of a Sales Orders, is that you can modify the Discount and Tax in the sub-total after the Sub Total. This is completely wrong, because Discount and Tax are calculated per the line-item. The Sub-total for the Discount and Tax is a SUM of each line-item field. Being able to edit Discount and TAX can incorrectly SUM up the Grand Total, and provide false costing to the client if a PDF Sales Order is sent out from Zoho.
To solve this, I have made 2 new aggregate formulas, which SUM up the line-item Discount and TAX, these 2 fields are: Total Discount & Total VAT. This means the Grand Total is now ((Quantity*Item Price)-Discount)+TAX.
However, when a Sales Order is created in Zoho from an order in WooCommerce via API, the Total Discount & Total VAT fails to calculate any value. So it means the user must go into the Sales Order > Edit > Save, then the aggregate calculation is run.