How to Build an AI Customer Service Chatbot for Your WooCommerce Store with n8n
A multilingual AI agent that answers product questions, collects orders conversationally, and logs every buyer to Google Sheets โ fully automated, zero code.
Running an online store means fielding the same questions at all hours โ “Do you have this in my size?”, “How much does shipping cost?”, “Can I order online?” Every answer is manual, every missed message is a lost sale. This n8n workflow replaces that cycle with a multilingual AI agent that knows your entire WooCommerce product catalog in real time, handles customer conversations in Arabic, English, or French, collects order details when a buyer is ready, and writes everything to a Google Sheet for your fulfillment team โ without you lifting a finger.
Prefer to skip the setup? Grab the ready-made template โ and be up and running in under 10 minutes.
What You’ll Build
- A customer opens your store’s chat widget and sends a message โ the agent immediately asks which language they prefer (Arabic, English, or French).
- The AI queries your live WooCommerce product catalog in real time before answering any product question โ it never guesses or invents details.
- If a product isn’t in stock, the agent politely asks whether the customer would like you to source it, then waits for a response.
- When the customer is ready to order, the agent collects their name, email, phone, address, country, and item through natural conversation โ no form required.
- The order details are automatically appended to a Google Sheet row, ready for your fulfillment team to action.
How It Works โ The Big Picture
The workflow has a single entry point โ the n8n Chat Trigger โ and routes every incoming message through an input guard before passing it to the AI agent. The agent has four tools it can call autonomously: a live product lookup, a Google Sheets writer, a calculator, and a “Think” reasoning step.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ AI ECOMMERCE CHATBOT (n8n) โ โ โ โ [Chat Trigger] โโโบ [If: chatInput exists?] โ โ โ โ โ โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ โ โ true (has input) false (empty) โ โ โ โ โ โ โผ โผ โ โ [Store Manager AI Agent] [Respond to Webhook] โ โ โโโโโโโโโดโโโโโโโโโ "How can I assist you?" โ โ โ AI Tools: โ โ โ โ โข Get Products โ โโโ Live WooCommerce product data โ โ โ โข Customer DB โ โโโบ Append row to Google Sheets โ โ โ โข Calculator โ โโโ Price / quantity math โ โ โ โข Think โ โโโ Internal reasoning step โ โ โโโโโโโโโฌโโโโโโโโโ โ โ โผ โ โ [Respond to Webhook 1] โโโบ Customer sees AI reply in chat โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
What You’ll Need
- n8n โ self-hosted or n8n Cloud (any recent version)
- WooCommerce store with REST API enabled and API keys generated
- OpenRouter account โ free tier available; choose your LLM (GPT-4o, Claude, Llama, etc.)
- Google account with a Sheets spreadsheet set up as the customer database
- A front-end chat widget that POSTs to an n8n webhook (the built-in n8n chat UI works out of the box)
Estimated build time: 45โ60 minutes from scratch, or under 10 minutes with the ready-made template.
Part 1 โ Receiving and Validating the Message
1 When Chat Message Received (Chat Trigger)
This is the entry point of the entire workflow. n8n’s built-in Chat Trigger node opens a publicly accessible webhook endpoint and provides a ready-made chat UI you can embed anywhere. Every customer message fires this node and passes two fields downstream: chatInput (the message text) and sessionId (a unique ID tying all messages in one conversation together).
Set Public to true so the chat interface is accessible without authentication. Leave Initial Messages blank โ the AI will send the first language-selection greeting itself.
// Data shape from the Chat Trigger
{
"chatInput": "Do you carry trail running shoes?",
"sessionId": "user_a8f3k2"
}
Tip: Embed the widget on your store by copying the script URL from the Chat Trigger node and adding it to your theme’s footer. No plugin required.
2 If โ Guard Against Empty Input
Browser pre-flight requests and widget load events can hit your webhook with an empty body. This If node checks whether $json.chatInput exists. If it does, the message goes to the AI agent. If not, a friendly default response fires immediately โ no wasted tokens, no errors.
Note: The condition uses strict type validation and checks for exists, correctly handling null, undefined, or a missing key โ all of which would otherwise crash the agent.
Part 2 โ The Store Manager AI Agent
3 Store Manager (AI Agent)
The Store Manager is the brain of the workflow โ an n8n AI Agent node that reads the customer’s message, decides which tools to call, executes them, and formulates a natural-language response. Its entire behavior is controlled by the system prompt, which you can customize directly in the node settings.
The system prompt instructs the agent to:
- Always open by asking for the customer’s preferred language (Arabic, English, or French)
- Respond only in the chosen language for the rest of the conversation
- Never invent product details โ always call
Get Productsfirst - Collect order information conversationally only after the customer expresses intent to buy
- Keep responses short and human โ no JSON, no bullet lists unless asked
Tip: The system prompt references the store name “MoroccoVibe”. Replace it with your own store name so the agent introduces itself correctly on the very first message.
4 OpenRouter (Language Model)
OpenRouter routes the agent to 100+ LLM providers. Switch between GPT-4o, Claude Sonnet, Mistral, Llama 3, and more by changing a single dropdown โ no other configuration needed. Add your OpenRouter API key in the credentials panel.
Tip: For customer service, Claude 3 Haiku or GPT-4o Mini offer excellent quality at very low cost โ typically under $0.01 per full conversation.
5 Simple Memory (Session Buffer)
The Simple Memory node gives the agent a 20-message conversation window keyed to each sessionId, so every customer’s chat is isolated and contextual. When a customer says “the second one you mentioned” four messages later, the agent knows exactly what they mean.
{
"sessionKey": "{{ $json.sessionId }}",
"contextWindowLength": 20
}
6 Get Products (WooCommerce Tool)
This tool gives the agent live, read-only access to your WooCommerce catalog. Whenever a customer asks about a product, the agent calls this tool automatically before answering โ no hardcoded product lists, always fresh data. Connect your WooCommerce API credentials (Consumer Key + Consumer Secret) found under WooCommerce โ Settings โ Advanced โ REST API.
Note: If your store has more than 100 products, filter by search term rather than returning everything โ fetching the full catalog on every message adds latency and increases token cost.
7 Customer Database (Google Sheets Tool)
Once the agent has collected all six required fields, it calls this tool to append a new row to your Google Sheet. Column values are written using $fromAI() expressions โ the agent extracts each field from the conversation context and maps it directly, no manual field setup needed beyond the initial schema.
8 Think & Calculator (Reasoning Tools)
Think lets the agent reason internally before complex answers โ useful for matching vague product descriptions or deciding whether to ask a clarifying question. Calculator handles all arithmetic (totals, discounts, unit quantities) to guarantee exact results and avoid LLM number drift.
The Data Structure
Create a Google Sheet with these exact column names before activating the workflow. The names are case-sensitive โ the agent uses them as keys when writing rows.
| Column Name | Type | Example Value | Description |
|---|---|---|---|
Items Name | Text | Trail Running Shoe โ Size 10 | Product(s) the customer wants to order |
Full Name | Text | James Carter | Customer’s full name as provided in chat |
Home address | Text | 742 Evergreen Terrace, Springfield, IL 62704 | Full delivery address |
Email Adresse | Text | james.carter@gmail.com | Matching key โ prevents duplicate rows |
Phone Number | Text | (555) 867-5309 | Contact number for delivery follow-up |
Country | Text | United States | Destination country for shipping |
Note | Text | Prefers express shipping | Extra notes from conversation (note the leading space in the column name) |
Important: Email Adresse is the matching key โ a second submission with the same email updates the existing row instead of creating a duplicate. The Note column has a leading space; keep this exactly as shown.
Full System Flow
Customer types in chat widget
โ
โผ
[Chat Trigger] โ { chatInput: "Do you carry trail running shoes?", sessionId: "user_a8f3k2" }
โ
โผ
[If: chatInput exists?]
โ true โ false
โผ โผ
[Store Manager Agent] [Respond to Webhook] โ "How can I assist you today?"
โ
โโโโบ [Think] โ reasons about customer intent
โโโโบ [Get Products] โ live WooCommerce catalog query
โ โโ returns: [{ name: "Trail Runner Pro", price: "$89.00", stock: "In stock" }]
โโโโบ (customer wants to order)
โ [Customer Database] โ appends Google Sheet row:
โ James Carter | james.carter@gmail.com | (555) 867-5309 | Springfield, IL | Trail Runner Pro
โโโโบ [Calculator] โ exact price/quantity arithmetic
โ
โผ
[Respond to Webhook 1] โ AI reply delivered to customer chat
Testing Your Workflow
- Click Test workflow in n8n, then open the Chat Trigger node and click Open Chat to launch the built-in test interface.
- Send “Hello” โ verify the agent responds asking for language preference.
- Reply “English”, then ask about a real product in your WooCommerce store. Confirm the agent returns accurate, live data.
- Say “I’d like to buy it” and walk through the information collection. Verify all six fields are captured correctly.
- Open your Google Sheet and confirm a new row was appended with the correct data.
- Send an empty message to confirm the fallback route fires the default greeting.
| Problem | Likely Cause | Fix |
|---|---|---|
| Agent says “I don’t have that information” | WooCommerce API key has insufficient scope | Ensure the key has Read access to products under WooCommerce โ Settings โ REST API |
| Google Sheet row not created | Column names don’t match schema exactly | Compare headers character-by-character, including the leading space in Note |
| Agent forgets earlier messages | Session ID not passing through correctly | Confirm the Chat Trigger is set to Public and sessionId is present in the payload |
| Agent responds in the wrong language | Language wasn’t chosen on the first message | Clear session memory and start a fresh conversation โ language selection must happen on message #1 |
| No response in the chat widget | Webhook response format mismatch | Check that Respond to Webhook 1 is set to allIncomingItems |
Frequently Asked Questions
Can I use a different AI model instead of OpenRouter?
Yes. The OpenRouter node is interchangeable with any n8n-supported language model โ OpenAI, Anthropic, Google Gemini, Mistral, and others all work as drop-in replacements. Just swap the model node on the agent’s Chat Model input and reconnect the credential. Nothing else changes.
What languages does the chatbot support?
Out of the box: Arabic, English, and French. Add or remove languages by editing the list in the Store Manager system prompt โ the AI handles the rest as long as your chosen LLM supports those languages, which most modern models do.
Will the agent handle multiple customers simultaneously?
Yes. Each conversation is isolated by its sessionId. The Simple Memory node stores history per session key, so 50 simultaneous customers each get their own private conversation context with no cross-contamination.
What happens if a customer submits their info twice?
Since Email Adresse is the matching key, a second submission with the same email updates the existing row rather than creating a duplicate โ keeping your sheet clean even if a customer changes their order details mid-conversation.
Does this work with WooCommerce variable products (sizes, colors)?
The Get Products node fetches product data including variations when available via the WooCommerce API. For more complex variant selection, consider adding a second WooCommerce node that fetches variations by product ID once the customer has chosen a base product.
Is the chat widget included in the template?
The n8n Chat Trigger provides a built-in widget accessible via a unique URL โ embed it in your WooCommerce theme as an iframe or script. Any front-end chat library that POSTs JSON to a webhook URL also works: Tidio, Crisp, or a fully custom implementation.
๐ Get the AI Ecommerce Chatbot Template
Download the ready-to-import workflow JSON, the Google Sheets setup template, and a step-by-step credential guide โ everything you need to go live in under 10 minutes.
Get the Template โInstant download ยท Works on n8n Cloud and self-hosted ยท 14-day refund guarantee
What’s Next?
- Order confirmation emails โ add a Gmail node after the Sheets tool to send an automated confirmation to the customer’s email the moment their details are saved.
- Slack fulfillment alerts โ ping your team channel with the customer name and item every time a new order row is created.
- Inventory warnings โ extend the WooCommerce tool call to check stock levels and proactively warn customers when an item is running low.
- Multi-store support โ duplicate the workflow and swap credentials to run the same agent for multiple storefronts, each with its own brand persona in the system prompt.