Process Flow: Order Fulfillment & Accounting

This is the core automated workflow that triggers after a customer successfully places an order. It handles the physical fulfilment of print products and the financial accounting for the entire transaction.

Trigger: A user successfully completes the checkout process in WooCommerce.

sequenceDiagram
    participant WC as "WooCommerce"
    participant Edge as "EDGE Store Plugin"
    participant CT as "ColourTech"
    participant Xero

    WC->>Edge: New order placed
    Edge->>Edge: Check if order contains print products
    alt Order has print products
        Edge->>CT: 1. Send order details for fulfillment (CreateEdgeOrder API)
        CT-->>Edge: Returns ColourTech Order ID
    end
    Edge->>Xero: 2. Create customer invoice
    alt Order has print products
        Edge->>Xero: 3. Create bill payable to ColourTech
    end

Step-by-Step Breakdown

  1. New Order: A new order is created in WooCommerce with a “Processing” or “Completed” status.
  2. Order Sync Trigger: The EDGE Store plugin detects the new order and triggers the order-sync process.
  3. Content Analysis: The plugin immediately checks if the order contains any physical print products using the ZohoHelper::orderHasPrint() function.

Fulfilment (ColourTech)

  1. Send to Printer: If the order contains print products, the plugin constructs a payload with the necessary order details (customer shipping address, product SKUs, quantities) and sends it to the ColourTech API (/api/CreateEdgeOrder).
  2. Confirmation: ColourTech receives the order, adds it to their printing queue, and returns a unique ColourTech Order ID, which is saved against the WooCommerce order for tracking purposes.

Accounting (Xero)

  1. Create Customer Invoice: The plugin connects to the Xero API and creates a new sales invoice for the full value of the order. This invoice is associated with the customer’s contact record in Xero.
  2. Create Bill for Costs: If the order contained print products (as determined in step 3), the plugin performs a crucial second action in Xero: it creates a bill.
    • Payable To: This bill is made payable to “ColourTech”.
    • Value: The value of the bill is the cost price of the printed goods, as sourced from the product data originally synced from Zoho.
    • Purpose: This correctly accounts for the Cost of Goods Sold (COGS) and ensures that the liability to the printer is recorded automatically.

Summary of Automated Actions

For a single order containing a physical book, the system performs the following automated actions without any human intervention:

  • The order is sent to the printer for fulfillment.
  • A sales invoice is created in Xero for the customer.
  • A bill is created in Xero to record the cost of printing.

This three-way integration ensures that the entire process, from customer purchase to fulfillment and accounting, is seamlessly connected.


This concludes the high-level process flows for Management & CTO. The next sections will dive into the technical details for developers.