A WooCommerce chatbot becomes much more useful when every product recommendation is traceable to a specific catalog item. Instead of replying with an unsupported statement such as “This jacket is waterproof and available in medium,” the chatbot should identify the product, link to its canonical page, and show the catalog fields used to form the answer.
Product citations improve customer trust, make answers easier to verify, and give agencies a practical way to debug incorrect recommendations. They also reduce the risk of a language model inventing prices, stock levels, attributes, or product URLs.
Define what a product citation contains
A citation should be more than a product name. At minimum, return the following information:
- Product name: The current WooCommerce product title.
- Product URL: The canonical URL generated by WooCommerce.
- Product identifier: The product ID, SKU, or both.
- Evidence fields: The attributes, description fragments, categories, or custom fields retrieved for the answer.
- Freshness information: A timestamp or indication of when price and stock data were checked.
A useful internal citation object can look like this:
{
"id": "product-1842",
"product_id": 1842,
"sku": "JKT-RAIN-BLU",
"name": "Waterproof Shell Jacket",
"url": "https://store.example.com/product/waterproof-shell-jacket/",
"evidence": [
"waterproof rating: 10,000 mm",
"sizes: S, M, L, XL",
"colour: blue"
],
"checked_at": "2025-02-14T10:30:00Z"
}
The model can use this object to write a natural response, while the application uses the identifier and URL to render a reliable citation.
Prepare WooCommerce data for retrieval
Do not send the entire catalog to the model for every conversation. Create a retrieval index containing the fields that are relevant to product discovery and comparison. Depending on the store, this may include:
- Product title, short description, and selected long-description sections
- SKU, product ID, brand, category, and tags
- Global attributes and variation attributes
- Price, sale price, currency, and tax display rules
- Stock status, backorder status, and purchasable state
- Shipping classes, dimensions, materials, compatibility data, and custom fields
- The canonical product URL and image URL
Keep transactional fields such as price and inventory in a system that can be queried at response time. A vector index can help find relevant products, but it should not be treated as the authoritative source for rapidly changing values.
For many stores, a scheduled indexing process can create searchable documents from WooCommerce data. A WordPress implementation can obtain a product URL and core fields with the WooCommerce CRUD API:
$product = wc_get_product( $product_id );
if ( $product ) {
$document = [
'product_id' => $product->get_id(),
'sku' => $product->get_sku(),
'name' => $product->get_name(),
'url' => get_permalink( $product->get_id() ),
'status' => $product->get_status(),
'content' => wp_strip_all_tags( $product->get_description() ),
];
}
Use the CRUD methods rather than reading database tables directly. This keeps integrations compatible with WooCommerce data abstractions and makes it easier to support custom product types.
Return sources separately from the generated answer
The model should not be responsible for inventing the final HTML link. Pass retrieved products into the generation prompt and require a structured response with an answer and a list of cited products.
For example, define an output contract similar to this:
{
"answer": "The blue Waterproof Shell Jacket is suitable for heavy rain and is available in medium.",
"citations": [
{
"source_id": "product-1842",
"claim_fields": ["name", "colour", "waterproof rating", "sizes"]
}
],
"needs_clarification": false
}
Your application can then map source_id to the trusted product record returned by retrieval. This prevents the model from changing a URL, adding tracking parameters, or citing a product that was not included in the evidence set.
If your provider supports structured outputs or function calling, enforce this schema at the API boundary. If it does not, validate the JSON before rendering it. Reject responses with unknown source IDs, missing URLs, or citations that refer to products excluded from the retrieval results.
Use an explicit citation instruction
Prompting should establish a strict relationship between claims and sources. A system instruction can include rules such as:
- Use only product facts present in the supplied evidence.
- Do not cite a product unless it supports the recommendation.
- Use the supplied source ID and never create a new product ID.
- Do not state current price or stock unless those fields were checked during this request.
- If the evidence is insufficient, ask a clarification question or say that the catalog does not confirm the claim.
- Return every recommended product in the citations array.
Include the source records in a delimited evidence section and make the distinction between instructions and catalog content clear. Product descriptions can contain arbitrary text, so retrieval content should be treated as untrusted data rather than as instructions to the model.
Render citations in the storefront
A citation can appear directly after a product claim or as a compact product card below the answer. For example, the frontend might render:
<p>The <strong>Waterproof Shell Jacket</strong> is available in blue and supports sizes S–XL.</p>
<ul class="chatbot-citations">
<li>
<a href="https://store.example.com/product/waterproof-shell-jacket/">Waterproof Shell Jacket</a>
<span>SKU: JKT-RAIN-BLU</span>
</li>
</ul>
Prefer creating links from the server-side product record. If the browser receives a URL from the model and prints it without validation, a prompt injection or model error could send customers to an unrelated domain. Allow only approved store domains, and consider generating the anchor element entirely from a product ID.
For accessibility, use descriptive link text, preserve keyboard focus, and ensure that citation cards are not the only way to understand the answer. A screen reader user should be able to identify the product and follow its link without relying on visual formatting.
Handle variable products and current values correctly
Variable products need special treatment. A parent product URL may be appropriate for general information, but a recommendation involving a specific size, colour, or price should cite the matching variation when possible.
Retrieve variation data after the initial product search and confirm:
- The requested attributes exist in the variation.
- The variation is enabled and purchasable.
- The selected variation has a valid price.
- Stock status is current for the selected attributes.
- The product URL can preserve the selection when the theme supports variation query parameters.
Do not cache a sentence such as “in stock” for longer than the business can tolerate. A practical design is to cache descriptive content for retrieval but perform a live WooCommerce lookup for stock, price, and purchasability immediately before the response is rendered.
Add citation tests to the agency workflow
Test citations as a product feature, not merely as a language-model prompt. Build a test set containing common customer questions and expected source products. Include cases for discontinued products, duplicate names, products with missing SKUs, out-of-stock variations, sale prices, and products with similar descriptions.
Useful automated checks include:
- Every recommended product has a valid WooCommerce product ID.
- Every citation URL resolves to the product’s current canonical URL.
- No citation points outside the approved store domain.
- Claims about price and stock match a fresh WooCommerce lookup.
- The answer does not cite products that were not returned by retrieval.
- A product with insufficient evidence is omitted or marked as requiring clarification.
Log the retrieved source IDs, the final citation IDs, the catalog version, and the timestamp of live price or inventory checks. This gives support teams enough information to reproduce an answer without storing unnecessary customer conversation data.
Use citations for analytics and merchandising
Once citations have stable product IDs, agencies can measure which products are recommended, clicked, added to cart, or rejected by customers. Track citation impressions and clicks separately from chatbot sessions. This reveals whether the retrieval system finds relevant products and whether the citation presentation helps customers continue to the product page.
Product citations also make merchandising rules easier to enforce. For example, the application can exclude hidden products, prioritize products from an approved category, or attach campaign metadata without asking the model to manage those rules. The chatbot generates an explanation; WooCommerce and the application layer remain responsible for catalog authority, links, pricing, stock, and purchasing state.