WooCommerce Product Recommendations in AI Chatbot
Your AI chatbot can search WooCommerce products and display them as cards with “Add to Cart” buttons — directly in the chat window. There are three methods to enable this, each suited for different store sizes and query types.
Path: WordPress Admin → AI Copilot → AI ChatBots → Edit Chatbot → Tools → WooCommerce
Quick Comparison
| Recommend Products | + Taxonomy Search | Vector Database (Pro) | |
|---|---|---|---|
| Search type | Keyword (WP_Query) | Keyword + attribute filtering | Semantic (embeddings) |
| Precision | Basic | High | Highest |
| API calls per query | 1 | 2 (taxonomy lookup + search) | 1 + embedding cost |
| Version | Free | Free | Pro |
| Setup | 1 checkbox | 1 extra checkbox | Requires building a knowledge base |
| Best for | Small catalogs, direct queries | Stores with attributes (size, color) | Large catalogs, vague/intent-based queries |
Method 1: Recommend Products (Basic Search)
Location: Chatbot Settings → Tools → WooCommerce → Recommend Products
When enabled, the AI gets a search_products tool that queries WooCommerce via WP_Query. The AI decides when to call it based on your prompt instructions.
Available Search Parameters
The AI can pass these parameters to search_products:
| Parameter | Type | Description |
|---|---|---|
query |
string | Full-text search across title, description, excerpt |
price_min |
number | Minimum price filter |
price_max |
number | Maximum price filter |
sku |
string | Exact SKU match |
in_stock |
boolean | Only in-stock products (default: true — out-of-stock excluded automatically) |
on_sale |
boolean | Only discounted products |
featured |
boolean | Only featured products |
sort_by |
string | Sorting: price_asc, price_desc, popularity, rating, date |
Configuration Options
- When to Recommend Products — instruction telling AI when to search. Example: “When a user asks about products, pricing, or requests a recommendation”
- Maximum Products per Response — cards shown per message (default: 3)
- Include/Exclude Products — limit or exclude specific categories or product IDs
- Card Display — Horizontal or Vertical layout
- Card elements — toggle image, name, price, description, categories, featured badge, add-to-cart button
Examples: What Works and What Doesn’t
✅ Good queries (basic search handles well):
| User message | AI calls | Why it works |
|---|---|---|
| “Show me laptops” | search_products({query: "laptops"}) |
Direct keyword match in titles |
| “Anything under $500?” | search_products({price_max: 500}) |
Price filter, no text needed |
| “Is MacBook Pro in stock?” | search_products({query: "MacBook Pro", in_stock: true}) |
Product name + stock filter |
| “What’s on sale?” | search_products({on_sale: true}) |
Simple flag filter |
| “Cheapest laptop” | search_products({query: "laptop", sort_by: "price_asc"}) |
Keyword + price sorting |
| “Most popular headphones” | search_products({query: "headphones", sort_by: "popularity"}) |
Keyword + popularity sorting |
❌ Bad queries (basic search fails):
| User message | Problem |
|---|---|
| “I need something for working from a coffee shop” | No keyword match — intent-based, not keyword-based |
| “Show me red dresses in size M” | Cannot filter by attributes (color, size) — only text search |
| “Something similar to the Dell XPS” | No concept of similarity — only exact word matching |
| “Gift ideas for my mom” | Abstract intent, no product names or keywords to match |
When to Use
Use this alone for stores with less than 100 products where users search by product name or type.
Method 2: Enable Taxonomy Search (Attribute Filtering)
Location: Chatbot Settings → Tools → WooCommerce → Enable Taxonomy Search (checkbox)
This adds a get_taxonomy_values tool and replaces the basic search_products with an extended version that accepts taxonomy filters. The AI function name stays search_products, but it now supports filtering by categories, tags, and product attributes.
How the AI Uses It
The AI follows a verify-then-search workflow. It retrieves all needed taxonomy values in a single call, then searches with verified slugs.
Example: User asks “Show me red wool sweaters in size L”
Step 1 — Verify taxonomy slugs (single call):
The AI calls get_taxonomy_values with all needed taxonomies at once:
| Parameter | Value |
|---|---|
taxonomies |
["pa_color", "pa_size", "pa_material"] |
The response returns a dictionary for each taxonomy where keys are slugs and values are human-readable names:
| Taxonomy | Response (slug → name) |
|---|---|
pa_color |
red → Red, blue → Blue, green → Green, … |
pa_size |
s → Small, m → Medium, l → Large, xl → X-Large, … |
pa_material |
cotton → Cotton, wool → Wool, polyester → Polyester, … |
The AI confirms that slugs red, l, and wool exist.
Step 2 — Search with verified slugs:
The AI calls search_products with the confirmed taxonomy slugs:
| Parameter | Value |
|---|---|
query |
"sweater" |
taxonomies |
pa_color: ["red"], logic: "OR"pa_size: ["l"], logic: "OR"pa_material: ["wool"], logic: "OR" |
tax_logic |
"AND" — all conditions must match |
Result: only products that are red, size L, and wool sweaters.
Why verify slugs first? Without verification, the AI might pass the user’s word “красный” directly, but the database stores red. The get_taxonomy_values call ensures the AI maps to correct slugs.
⚠️ Important: The system prompt instructs the AI to fetch all needed taxonomies in one call by passing them as an array, not one-by-one. This minimizes API calls.
Supported Taxonomies
product_cat— product categoriesproduct_tag— product tagspa_*— any WooCommerce global attribute (pa_color, pa_size, pa_brand, pa_material, etc.)
The plugin automatically lists all available taxonomies for your store in the AI system prompt, so the AI knows what’s available.
Filter Logic
| Parameter | Values | Description |
|---|---|---|
logic (per taxonomy) |
"OR" / "AND" |
OR = match ANY value (color red OR blue). AND = match ALL values simultaneously |
tax_logic (between taxonomies) |
"AND" / "OR" |
AND = ALL taxonomy conditions must match. OR = ANY condition can match |
Examples: What Works and What Doesn’t
✅ Good queries (taxonomy search handles well):
| User message | AI workflow | Result |
|---|---|---|
| “Red dress size M” | Verify pa_color → red, pa_size → m, search with both | Exact match by attributes |
| “Nike running shoes” | Verify pa_brand → nike, product_cat → running-shoes | Brand + category filter |
| “Cotton t-shirts under $30” | Verify pa_material → cotton, search with price_max: 30 | Material + category + price |
| “Red or blue sweaters” | Search with pa_color: [“red”, “blue”], logic: “OR” | Multiple values in one taxonomy |
❌ Bad queries (taxonomy search still fails):
| User message | Problem |
|---|---|
| “Something elegant for a dinner party” | “Elegant” is not a taxonomy value — it’s subjective intent |
| “Laptop good for video editing” | Performance characteristics aren’t typically stored as attributes |
| “Something like what I bought last time” | Requires purchase history, not attribute filtering |
⚠️ Important: Taxonomy search only works well when your products have properly filled WooCommerce global attributes. If your products don’t have size, color, or other attributes assigned, this method won’t improve results over basic search.
When to Use
Add this when your store has structured product attributes (size, color, brand, material) and users frequently filter by these properties.
Method 3: Vector Database — Semantic Search (Pro)
Location: Chatbot Settings → Knowledge tab
This uses embeddings — numerical representations of text that capture meaning. Instead of matching keywords, it finds products whose descriptions are semantically similar to the user’s query.
How It Works
Setup phase (one-time):
- Plugin loads product data (title, description, attributes, price)
- Text is split into chunks (default: 512 tokens, 50 token overlap)
- Each chunk is sent to an AI embedding model → numerical vector (e.g., 1536 dimensions)
- Vectors are stored in chosen backend (WP Vector / Pinecone / Qdrant)
Query phase (every chat message):
- User query is converted to a vector using the same embedding model
- Cosine similarity search finds the most relevant product chunks
- Top matching chunks are added to the AI context
- AI generates a response using the matched product information
Setup Steps
Step 1: Open the Knowledge tab in your chatbot settings and select a Knowledge Base (or create a new one).
Step 2: Choose AI provider for embeddings. Available providers:
| Provider | Models | Notes |
|---|---|---|
| OpenAI | text-embedding-3-small, text-embedding-3-large, text-embedding-ada-002 | Best cost/quality ratio with text-embedding-3-small |
| Gemini | Google AI embedding models | Alternative if you already use Google AI |
Step 3: Configure chunking.
- Chunk Size — tokens per chunk (default: 512, min: 50, max: 8191). Larger = more context per chunk, less precise matching
- Chunk Overlap — overlap between chunks (default: 50). Prevents information loss at chunk boundaries
Step 4: Choose vector storage.
| Storage | Description | Best for |
|---|---|---|
| WP Vector | Stores in WordPress database. No external services needed | Small to medium catalogs (< 1000 products) |
| Pinecone | Cloud vector database. Requires API key and index host | Large catalogs, high-performance needs |
| Qdrant | Self-hosted vector database. Requires API URL and collection name | Full control, own infrastructure |
Step 5: Go to the Products subtab inside Knowledge → include/exclude products by categories or specific IDs.
Step 6: Click Sync to process products, generate embeddings, and upload to storage.
⚠️ Re-sync required whenever you add, update, or remove products.
Examples: What Works and What Doesn’t
✅ Good queries (semantic search excels):
| User message | Why it works |
|---|---|
| “Something for working remotely from a cafe” | Matches laptops described as portable, long battery life, lightweight |
| “Gift for a tech enthusiast” | Understands intent, matches gadgets and accessories by description context |
| “I need to edit 4K video on the go” | Matches high-performance laptops even if “4K video editing” isn’t in the title |
| “Comfortable shoes for standing all day” | Semantic understanding of comfort + long wear from product descriptions |
| “Eco-friendly alternatives to plastic containers” | Matches products with sustainability keywords across descriptions |
❌ Bad queries (semantic search struggles):
| User message | Problem | Better method |
|---|---|---|
| “Red dress size M” | Attribute filtering is more precise — embeddings may return wrong size/color | Taxonomy Search |
| “Product SKU ABC-123” | Exact lookup, not a semantic task | Basic Search (sku parameter) |
| “What’s on sale?” | Sale status is a DB flag, not captured in embeddings | Basic Search (on_sale parameter) |
| “Cheapest laptop you have” | Price sorting requires structured query | Basic Search (sort_by: price_asc) |
💡 Best practice: Combine vector search (Knowledge tab) with basic search + taxonomy (Tools tab). The AI uses all available sources — embeddings for understanding intent, taxonomy for precise attribute filtering, and basic search for price/stock/sale/sorting queries.
When to Use
Use for stores with 500+ products, rich product descriptions, and users who ask vague or intent-based questions.
Product Cards in Chat
All three methods display results as product cards in the chat window. The AI returns a text response followed by a delimiter containing product IDs (format: ##IDS##prod:42,67,103). The chatbot parses this automatically and renders cards.
Card layouts:
- Horizontal — image left, info right (compact, good for lists)
- Vertical — image top, info bottom (visual, good for browsing)
Toggleable card elements: image, product name, price, short description, category, featured badge, add-to-cart button. Each can be turned on or off in Tools → WooCommerce settings.
Choosing the Right Method
| Store size | Recommended setup |
|---|---|
| < 100 products, keyword searches | Recommend Products only |
| 100–500 products with attributes | Recommend Products + Taxonomy Search |
| 500+ products or intent-based queries | Vector Database (Pro) |
| Maximum accuracy | All three combined |
When all three are active: the Tools tab handles structured search (keywords, attributes, price, stock, sorting), the Knowledge tab handles semantic understanding. The AI picks whichever source best matches each query.
