We built DEV3 AI Product Q&A as a WooCommerce plugin in PHP with a React admin and a small vanilla JS storefront script. The product page, inbox, emails, spam protection, search and structured data all work without an API key; DEV3 AI is a layer on top.
Key design decisions
- Per-product knowledge chunks. Each product is split into chunks: a facts block (price, availability, SKU, weight, dimensions, categories, rating), attributes, the short description, the description in parts of about 700 characters, up to 30 approved reviews and up to 30 published Q&A. Chunks are keyed by kind, reference and content hash, so an unchanged chunk keeps its id and its embedding.
- Hybrid retrieval scoped to one product. Keyword overlap and embeddings search are fused by reciprocal rank, and the vector search is restricted to the ids of this product's chunks. Facts and attributes always go into the prompt first.
- Citations are checked, not trusted. The model returns
source_ids with its answer. Ids that were not in the retrieved set are dropped, an answer that cites nothing loses 40% of its confidence, and an answer the model marks as not answerable is capped at 0.4.
- Auto-publish is opt-in and narrow. An AI answer appears instantly only when the merchant turned the switch on, the storefront AI kill switch allows it, and the draft is answerable, not spam, not off-topic, at or above the threshold (85% by default) and cites at least one real source. Everything else waits in the inbox, and auto-published answers are labelled on the page.
- Spam handled before AI. A honeypot that returns a normal reply to bots, an HMAC-signed timing token, a link limit, an hourly limit per email and IP hash, exact-duplicate detection per product, blocked words and Akismet. DEV3 AI adds spam and off-topic flags on top.
- Search engines see only published content. JSON-LD as FAQPage or QAPage (with accepted and suggested answers, upvotes and author types), built from published, answered questions only and capped at 20.
Architecture
The first page of questions is rendered on the server, so there is no layout shift and the content is in the HTML for caching and SEO. The storefront script calls same-origin, rate-limited REST routes for search, asking, votes, reports and customer answers. A new question either gets an instant answer attempt (when auto-publish is on) or a background draft job, so the shopper never waits for a draft. The admin has a Dashboard, a Questions inbox with a draft review panel, Add & FAQ with AI FAQ suggestions, Import / Export (questions hidden in reviews, CSV in and out) and Settings with a live preview. The API client, encrypted key storage, monthly AI budget, embeddings store, job runner and usage logs come from a shared core used across DEV3's plugins.