How to Auto-Sync WooCommerce Orders to Google Sheets with n8n (2025 Guide)

What is n8n for WooCommerce Automation?

n8n is a workflow automation tool that connects WooCommerce to apps like Google Sheets, Slack, or CRMs without expensive plugins. It works by listening for Webhooks (real-time data signals) sent by WooCommerce whenever a new order is placed, transforming that raw JSON data, and automatically pushing it to your destination in seconds.

Stop Copy-Pasting: The “Hidden Tax” on Store Owners

If you are running a WooCommerce store, you know the pain: you get an order, but then you spend 5 minutes copying the customer details, shipping address, and product list into your fulfillment spreadsheet.

It doesn’t sound like much, but at 10 orders a day, that’s 25 hours a year wasted on data entry.

In this guide, I will show you how to automate this completely using n8n. Unlike other tools that charge per “task” (looking at you, Zapier), n8n allows you to run complex workflows with complex logic for free if you self-host it.

Why Trust This Guide?

I have built automation pipelines for dozens of high-volume WooCommerce stores. In our testing, we found that most “simple” integrations fail because they don’t handle nested line items correctly (e.g., when a customer buys multiple products in one order). This guide solves that specific problem.

The Workflow Blueprint

We are going to build a 3-step pipeline:

  1. Trigger: WooCommerce sends data to n8n via Webhook.
  2. Transform: n8n cleans the data and flattens the “Line Items” array.
  3. Action: n8n adds a new row to Google Sheets.

Note: You need an active n8n instance and administrative access to your WordPress site.

Step 1: Configure the n8n Webhook

First, we need a URL for WooCommerce to talk to.

  1. Open your n8n editor and add a Webhook node.
  2. Set the HTTP Method to POST.
  3. Copy the Test URL (we will switch to Production URL later).
  4. Click “Listen for Test Event”.

Step 2: Set Up WooCommerce

Now, tell WooCommerce to send data to that URL.

  1. Go to WooCommerce > Settings > Advanced > Webhooks.
  2. Click Add Webhook.
  3. Name: n8n Order Sync
  4. Status: Active
  5. Topic: Order Created
  6. Delivery URL: Paste the n8n Test URL you copied.
  7. Secret: Leave this default or generate one (we use this to verify security later).
  8. Click Save Webhook.

Pro Tip: After saving, create a test order in your store immediately. If you go back to n8n, you should see the JSON data appear in the Webhook node.

Step 3: The “Secret Sauce” (Handling Line Items)

This is where most tutorials fail. WooCommerce sends products as a list (array). If you try to push this directly to a single spreadsheet cell, you will get a messy [Object, Object] error.

We have two options:

  • Option A (Simple): Create one row per order, summarizing items into a text string.
  • Option B (Advanced): Create one row per product (great for inventory tracking).

We will use Option A for this guide as it’s cleaner for finance reports.

  1. Add a Code Node (or “Set” node) after the Webhook.
  2. Use this JavaScript snippet to format the line items:
// Loop through items and create a readable string
const items = $input.item.json.line_items;
const itemString = items.map(p => `${p.quantity}x ${p.name}`).join(', ');

return {
  json: {
    order_id: $input.item.json.id,
    total: $input.item.json.total,
    customer_email: $input.item.json.billing.email,
    items_summary: itemString, // "2x T-Shirt, 1x Cap"
    date: $input.item.json.date_created
  }
}

Step 4: Send to Google Sheets

  1. Add the Google Sheets node.
  2. Connect your Google account.
  3. Resource: Row -> Operation: Append.
  4. Select your Spreadsheet and Sheet ID.
  5. Map the columns:
    • Column A (Order ID) -> {{ $json.order_id }}
    • Column B (Email) -> {{ $json.customer_email }}
    • Column C (Items) -> {{ $json.items_summary }}
    • Column D (Total) -> {{ $json.total }}

Common Pitfalls & Solutions

“The Webhook isn’t firing!”

In our experience, this is usually a WordPress cron issue. WooCommerce webhooks are processed asynchronously.

  • Fix: Ensure your WP-Cron is running, or use the command line wp cron event run --due-now to force it during testing.

“I’m getting duplicate orders”

Webhooks can sometimes retry if n8n doesn’t respond quickly enough (within 10 seconds).

  • Fix: In your n8n Webhook node settings, ensure “Respond Immediately” is checked so n8n says “OK” to WooCommerce before it starts processing the Google Sheet logic.

Conclusion

You now have a live connection between your store and your data. No more copy-pasting, and no monthly fees for a simple sync plugin.

Next Steps:

  • Want to notify your team? Add a Slack or Discord node after the Google Sheets step.

Related posts

Leave the first comment