The LOVE&SAKE assistant filters out unavailable products when building its index. A bottle that sells out before the next sync can still appear in an answer, so each recommendation card links to the WooCommerce product page where shoppers confirm current availability.
Using “looking for a gift sake under NT$3,000” as a walkthrough, editorial articles explain flavor and pairing, the product index retrieves candidate bottles, and the store holds live inventory. Below is how those three layers work together in the WordPress/WooCommerce assistant Collective 353 built for LOVE&SAKE.
Separate the roles first: articles carry knowledge, products carry sellability
For high-ticket, nuance-heavy categories like sake, shoppers rarely navigate by strict taxonomy trees. They usually start from a real-life occasion. LOVE&SAKE already had a large library of sake editorial articles alongside its WooCommerce catalog, so we gave each source a distinct job.
WordPress articles handle terminology, serving temperatures, flavor profiles, and food pairings. During indexing, each article is split along its H2 and H3 heading hierarchy, keeping section context and source URLs intact so the assistant cites the exact passage. WooCommerce products carry the title, price, categories, tags, stock status, catalog visibility, and product URL. Each SKU is indexed as one semantic object (one vector per product) and can be enriched during indexing with occasion cues, tasting descriptions, and semantic tags so phrases like “gift,” “beginner-friendly,” or “fruity” match actual bottles.
Both articles and products live in the same vector database, separated by an explicit type field. At query time, the system retrieves article chunks and product objects in parallel. Long-form essays do not crowd out purchasable products, and discontinued bottles mentioned in older posts cannot show up as in-stock items.
One full walkthrough: from “gift sake under NT$3,000” to the product page

When a visitor opens the chat widget in the bottom-right corner and types “looking for a gift sake under NT$3,000” (one of the starter prompts in LOVE&SAKE’s assistant), the request moves through three stages:
[Data Preparation & Indexing Layer]
WooCommerce products (latest 500) + WordPress articles
→ Index-time filtering (keep only published, in-stock, catalog-visible products + tag index generation)
→ Embed and write to Cloudflare Vectorize (with stock, visibility, price, and generation metadata)
[Query & Retrieval Layer]
Visitor asks: "Looking for a gift sake under NT$3,000"
→ 1. Intent & constraint parsing (intent: recommend, budget cap: 3,000, occasion: gift; expand search terms)
→ 2. Split vector search (products pre-filtered by stock_status / catalog_visibility / generation; articles searched for knowledge chunks)
→ 3. Post-retrieval guardrails (re-check stock, visibility, generation, and 20% flexible budget cap of NT$3,600 against runtime config)
→ 4. Tiering & response grounding (top 5 as featured picks, #6–10 as extended options; model restricted strictly to products in context)
[Commerce Handoff Layer]
Conversational reply + product cards (name, price, tasting summary)
→ Visitor clicks a card → lands on LOVE&SAKE's WooCommerce product page to confirm current stock and check out
During intent parsing, the system scores how much context the visitor has given. If someone simply asks “recommend a sake,” the confidence score falls below the 0.7 threshold, and the assistant asks clarifying questions about budget, flavor profile, and occasion first. “A gift sake under NT$3,000” gives category, budget, and occasion all at once and clears the threshold. The system expands “gift” into semantic queries like “Daiginjo gift box,” “premium gift sake,” and “limited-edition sake,” while applying a default 20% budget buffer (up to NT$3,600) so a relevant gift box slightly above the stated cap is not cut off outright.
Each setting answers a different question. The 0.7 threshold controls when to ask a follow-up, the 20% allowance admits over-budget candidates, and 500 caps the products indexed per run. A NT$3,600 gift still exceeds a shopper’s explicit NT$3,000 limit. To evaluate that allowance, a team can isolate requests with a firm ceiling and count how often a recommendation exceeds it. This case reports neither that rate nor purchase conversion.
When generating the reply, the top 5 retrieved products are passed as featured picks, and the prompt restricts the model to referencing only those items and their provided prices without inventing SKU names outside the retrieved context. The frontend then renders those items as clickable product cards linking directly to the store’s product pages.
Three gates that block out-of-stock items, and the one thing we did not build
- Editorial
Explain flavor and occasion
- Index
Retrieve from a sellable-product snapshot
- Store
Check current availability on the product page
Back to the core question: where does the system check stock? Comparing directly against the implementation, here is what is built and what was left out:
| Check stage | Where it runs | What it does | Fallback when fields are missing or queries fail |
|---|---|---|---|
| Gate 1: Store fetch at index time | Indexer Worker calling WooCommerce API | Fetches only the latest 500 published products matching the configured stock filter (e.g., instock) |
Single stock condition is pre-filtered via API query params before local gating |
| Gate 2: Local gate before vector write | Indexer Worker local validation | Re-checks status, stock_status, and catalog_visibility (WooCommerce’s API has no visibility filter param, so it must be filtered locally) |
Fail-closed: any product missing stock_status or catalog_visibility is excluded rather than letting unknown states into the index |
| Gate 3: Snapshot check at query & answer time | Query Worker (Vectorize pre-filter + post-query hard filter) | Constrains Vectorize metadata filter by stock_status, visibility, and current catalog_version before search; re-verifies results against Cloudflare KV runtime config afterward |
Fail-closed: if pre-filtering fails, product search never degrades to unfiltered search; legacy vectors missing stock fields are also blocked |
| Live WooCommerce stock lookup at answer time | Not implemented | Query Worker does not call the WooCommerce API or check per-SKU stock on every chat turn | Answers rely on the snapshot captured when the index was built or updated; final availability is confirmed on the store’s product page |
In short, LOVE&SAKE does not query the WooCommerce database on every chat turn. Out-of-stock and hidden products are kept out of the recommendation pool through strict index-time gating and query-time snapshot isolation.
In our note on a Shopify Custom App fulfillment workflow, we argued against replicating an inventory master and insisted on reading live store state before every action. The reason AI-guided shopping uses an index snapshot instead is that semantic discovery and transactional fulfillment writes have very different load profiles and error tolerances.
Checkout, inventory deduction, and warehouse assignment belong to the transactional layer. Each operation targets one known order with zero tolerance for stale data, so the store’s primary database must be the sole live authority. Natural-language product Q&A sits in the discovery layer, where shoppers are still exploring hundreds of SKUs and articles with fuzzy criteria. Calling the WordPress origin API for 10 to 50 candidate SKUs on every chat turn would add latency and put load on the storefront during traffic spikes. A strictly filtered vector snapshot trades per-turn origin lookups for fast retrieval and origin protection. As soon as a shopper clicks a card to buy, the WooCommerce product page takes over with live stock checks.
Because Cloudflare Vectorize does not support listing and purging all stale vectors in a single call, every vector is also stamped with a generation tag (catalog_version). Whenever indexing rules change and a rebuild runs, a new generation ID is written and the query layer immediately filters only to that new generation. Older vectors that went out of stock or dropped out of the latest 500 cannot resurface even while cleanup is still running.
What happens if a bottle sells out after the index was built?
Because a vector index is a snapshot from the last sync, a bottle that was in stock during indexing can sell out two hours later before the next refresh. If a visitor asks a question in that window, the query layer still reads instock from the snapshot metadata and may include that bottle in its reply. Once the visitor clicks the product card, they land on LOVE&SAKE’s WooCommerce product page and see that the item is out of stock.
Every snapshot-based RAG shopping assistant has to deal with this gap between an inventory change and the next index update. Depending on catalog turnover, teams can choose from three sync setups:
| Sync strategy | Mechanism & current status | Strengths | Blind spots to watch |
|---|---|---|---|
| Manual full re-index from admin | LOVE&SAKE’s current operating mode (paired with generation tags and stale-vector cleanup scripts) | Simple workflow; refreshes the latest 500 products cleanly around restocks or seasonal campaigns | Fast-moving campaign items carry sync lag until the next manual rebuild |
| Single-product webhook sync | Sync endpoints already exist on both the plugin and Indexer sides: product updates/deletes push to the Indexer, removing non-qualifying vectors and backfilling from the catalog | Quickly removes items from the recommendation pool when staff change status or unpublish a product | Requires configuring endpoint URL and auth key in the store plugin; also verify the plugin listens to stock-status change events when checkout drives stock to zero, since relying only on product-save hooks can miss automated stockouts |
| Lightweight check on final candidates before replying | Future evolution option (not currently deployed) | Narrows stock discrepancy on the top 5 featured picks | Adds store API latency, timeout fallback logic, and caching complexity |
Interface copy helps cushion that gap as well. Avoid presenting the assistant as a guaranteed stock checker, link every card straight to the live product page, and return 5 featured picks alongside extended options so that if one bottle just sold out, the shopper still has other in-stock alternatives matching their budget and occasion.
Four decisions to align on before adding an AI shopping assistant
Before adding AI-guided shopping to WooCommerce or another storefront, align with the team on four boundaries.
First, decide where the catalog boundary sits: should the index include every historical SKU, or only published, in-stock, catalog-visible products within a recent cap such as the latest 500? Next, settle how to handle missing fields when an API response omits stock or visibility metadata, and whether the indexer should exclude those records by default.
Then determine how much inventory lag your catalog can accept. Slow-turning curated catalogs often run fine on weekly or pre-campaign manual refreshes, while limited drops or fast-moving SKUs call for webhooks, scheduled refreshes, or lightweight checks on the final recommendation cards. Finally, keep the responsibility line clear: the AI turns fuzzy shopper intent into grounded candidate lists, while live pricing, stock, and checkout terms stay strictly on the store’s product page.
Further reading & services
- Related notes: When off-the-shelf Shopify doesn’t fit operations: how to run a Custom App experiment, How consultants review AI-organized immigration knowledge before it reaches clients
- Case study: See the delivered scope and live interface screens → LOVE&SAKE AI shopping assistant case study
- Service scope: Already have a growing catalog and content library and want to design a grounded retrieval and recommendation workflow? → AI assistants and workflow integration
- Get in touch: Want to talk through your product catalog structure and index refresh cadence? → Contact Collective 353
