Function #8: Add additional charges to invoices
Here goes one of the highly sought-after custom functions in Zoho Books. If you find yourself needing to apply additional charges to customers on their invoices (say credit card surcharges, or fuel charges applicable to customers from a certain region, or transaction fees), this function would save you a good deal of time and effort by doing it automatically and accurately for you.
The function we've written will add the additional charges as a new line item in the invoices you create.
Prerequisites:
Create a Checkbox type custom field named "Charge Customer" (or anything similar) for the Customers module. This enables you to apply the charges to invoices of specific customers by ticking the checkbox at customer level. We also have the Bulk Update option to update this value for multiple customers at once.
Custom Function:
Head to Settings -> Automation -> Custom Functions -> +New Custom Function to set it up.
You can get the code from this
GitHub link. The first 4 lines of the function code (percentage of the charges, account name, tax name, item name) can be modified as per your need before saving the function.
You must also create a connection named "zbooks" for the function to work. Watch this to know how to create it:
![](https://desk.zoho.com:443/support/ImageDisplay?downloadType=uploadedFile&fileName=1687504003175.gif&blockId=48d0a45894056572e815c1bf328221710aba6ad3d0c04e99&zgId=b54d79c69095249d&mode=view)
Workflow Rule:
The final step towards jump-starting the automation is setting up a workflow rule. Go to Settings -> Automation -> Workflow Rules -> +New Workflow Rule and configure it as shown below.
Select the respective custom function finally and save the workflow. This will execute on all the upcoming invoices you create (after the invoice is saved) for customers whose checkbox custom field is enabled.
Feel free to connect with us if you require further customization for this function.
Follow our page to get updates when new posts go up and stay tuned for more useful custom functions coming your way!
Regards,
Divya R
Zoho Books