Automatically Create Zoho Books Invoices When WooCommerce Orders Are Completed

Automatically Create Zoho Books Invoices When WooCommerce Orders Are Completed

Overview

Automating invoice creation can streamline your sales and accounting processes. With Zoho Flow, you can set up a workflow that automatically creates a Zoho Books invoice when an order in WooCommerce is marked as "Completed." This guide walks you through the step-by-step process of configuring this integration, including handling tax, shipping, discounts, and custom fields.

Steps to Set Up the Integration

1. Configure the WooCommerce Trigger in Zoho Flow

  • In Zoho Flow, click Create Flow and provide a name (e.g., "WooCommerce to Zoho Books Invoice").

  • Choose WooCommerce as the trigger app and select Order Updated as the event.

  • Connect your WooCommerce account using REST API keys or OAuth credentials.

2. Filter Orders by "Completed" Status

  • Add a Decision block after the trigger.

  • Set the condition: Order Status equals "completed".

  • Proceed only with the "Yes" branch to continue the workflow.

3. Retrieve Detailed Order Data

  • Add Fetch Order (WooCommerce) action.

  • Map the Order ID from the trigger to fetch complete order details (line items, tax, shipping, custom fields).

  • If necessary, use a Webhook trigger or custom function to access custom order meta fields.

4. Check if Customer Exists in Zoho Books

  • Use Fetch Customer (Zoho Books) to search for an existing customer by email.

  • Add a Decision block:

    • If the customer does not exist, use Create Customer.

    • If the customer exists, you may optionally update them with Update Customer.

5. Create Invoice in Zoho Books

  • Add a Create Invoice action.

  • Map the required fields:

    • Customer ID from the previous step.

    • Invoice Date, Order Number, and any custom fields.

    • Line Items: If mapping multiple line items, use a custom function to construct the invoice using the Zoho Books API.

    • Alternatively, create a single-line invoice with a summary and include total tax, shipping, and discounts.

    • Tax: Map tax codes that match WooCommerce's settings.

    • Shipping Charges: Map from the WooCommerce shipping total.

    • Discount: Map the total discount as an amount.

6. Test and Activate the Flow

  • Use Test and Debug mode to simulate an order completion.

  • Review each step to ensure data is passed correctly.

  • Check the generated invoice in Zoho Books.

  • Once verified, activate the flow.

Best Practices and Tips

  • Use descriptive field mappings and variable names to keep your flow organized.

  • Always test with orders that include different combinations (e.g., with/without tax or discount).

  • Maintain a list of matching tax codes in both WooCommerce and Zoho Books.

  • Use custom functions for advanced handling like multi-line invoices.

  • Refer to Zoho Books API Documentation for custom function parameters.

Need Help?

If you need assistance with creating custom functions or troubleshooting your Zoho Flow setup, please contact our support team or visit Zoho Flow to know more.