Product data is rarely stored as one clean, self-contained document. A WooCommerce product may include a title, short description, long description, attributes, variations, dimensions, stock information, shipping restrictions, custom fields, and taxonomy terms. Sending all of that content to an embedding model as one large chunk can reduce retrieval accuracy, while splitting it into arbitrary fragments can remove the context needed to answer a customer or staff question.
Effective chunking creates small, meaningful retrieval units while preserving the relationships between the product, its variations, and its commercial rules. For WooCommerce agencies, this is an application architecture decision rather than only a text-processing step.
Why WooCommerce product data needs structured chunking
A typical product question may concern very different fields:
- “What material is this product made from?” requires descriptive content or attributes.
- “Does the blue version come in medium?” requires variation attributes and availability.
- “How large is the package?” requires dimensions or shipping data.
- “Can this item be shipped to Alaska?” requires shipping classes, locations, or store-specific rules.
- “What accessories are compatible with it?” may require linked products, categories, or curated metadata.
If every field is embedded in one document, a query about one variation may retrieve a large block dominated by unrelated marketing copy. If every field is embedded independently, the result may contain “medium” without identifying the product or “0.5 kg” without indicating whether it describes the item or its packaging.
The goal is to create chunks that are semantically focused but independently understandable.
Define the retrieval units before writing a chunker
Start by identifying the questions the WooCommerce assistant must answer. The answer types usually map to a small number of retrieval units:
- Product overview: name, product type, brand, category, summary, and primary use case.
- Product details: long description, specifications, materials, care instructions, and included items.
- Attributes: structured properties such as color, size, finish, compatibility, or capacity.
- Variation information: variation-specific attributes, SKU, price, stock state, dimensions, and variation description.
- Commercial policies: returns, warranty, shipping, subscription terms, and purchase restrictions.
- Relationships: related products, upsells, cross-sells, bundles, and replacement parts.
These units should reflect the retrieval behavior you want. A customer asking for a size should not need to retrieve the complete long description. A question about returns should retrieve policy content with the relevant product or store scope.
Use a parent-child representation
A practical pattern is to create a parent product record and several child chunks. Each child chunk contains focused text plus metadata that identifies its parent.
For example, a product could produce records like these:
{
"chunk_id": "product-842-details",
"parent_product_id": 842,
"product_name": "Trail Shell Jacket",
"chunk_type": "details",
"text": "Trail Shell Jacket is a waterproof three-layer shell jacket made from recycled nylon. It includes taped seams, adjustable cuffs, and a helmet-compatible hood.",
"metadata": {
"sku": "TSJ-001",
"categories": ["Jackets", "Outdoor Clothing"],
"language": "en",
"source_version": 17
}
}
The parent product ID allows the application to group or expand results after retrieval. The chunk type supports filtering, reranking, and answer-generation rules. Metadata should be stored separately from the embedded text whenever the vector system supports metadata filters.
Recommended chunk types for WooCommerce products
1. Overview chunk
Create one concise chunk containing the product name, brand, category, short description, and primary use case. Include enough identity information for the chunk to make sense when retrieved on its own.
Example:
Trail Shell Jacket is a waterproof outdoor jacket from North Ridge. It is designed for hiking and daily use in wet weather. The jacket belongs to the Jackets and Outdoor Clothing categories.
Avoid copying every paragraph of the long description into this chunk. Its purpose is product identification and broad matching.
2. Specification chunk
Group stable technical facts such as materials, dimensions, weight, capacity, care instructions, included items, and certifications. Use explicit labels so that the embedding and the final language model can distinguish similar values.
Trail Shell Jacket specifications: material: recycled nylon; construction: three-layer shell; waterproof rating: 20,000 mm; weight: 420 g; care: machine wash cold; included items: jacket and storage pouch.
Structured labels are generally safer than concatenating raw values with commas. They reduce ambiguity and make the chunk easier to audit.
3. Attribute chunk
Product attributes often support faceted search and natural-language questions. Serialize them consistently, including the attribute name and value:
Trail Shell Jacket attributes: color: black, blue, olive; fit: regular; gender: unisex; sizes: small, medium, large, extra large; season: spring, autumn, winter.
Do not infer values that are not present in WooCommerce. In particular, do not convert an attribute such as “water resistant” into “waterproof” unless that distinction is explicitly defined by the catalog.
4. Variation chunks
Variable products require special handling. A parent-level chunk can describe the product generally, but size, color, SKU, price, and stock may belong to individual variations. Create a separate chunk for each variation when those details are important to retrieval.
Trail Shell Jacket variation. SKU: TSJ-001-BLU-M. Color: blue. Size: medium. Price: 129.00 USD. Stock status: in stock. Stock quantity: 8. This variation uses the regular fit.
Include the parent product name in every variation chunk. Without it, a result such as “color: blue; size: medium” is not useful to the answer-generation step.
Inventory and price are volatile fields. Store a synchronization timestamp and decide whether these values should be embedded, filtered as metadata, or fetched live from WooCommerce after retrieval. For many stores, the safest pattern is to use embeddings to identify the product and then query current price and stock through WooCommerce at answer time.
5. Policy and fulfillment chunks
Shipping, returns, warranty, and purchase restrictions often apply to a product, category, shipping class, or entire store. Keep these rules separate from marketing content and record their scope.
Trail Shell Jacket return policy: eligible for return within 30 days of delivery if unworn and returned with original tags. Final-sale items are excluded. This policy applies to products in the Outdoor Clothing category.
A policy chunk should include an effective date or revision identifier. If store-wide policy content is repeated into every product chunk, updates become expensive and conflicting versions can be retrieved together.
Choose chunk boundaries based on semantics, not character counts
Character or token limits still matter, but they should be a constraint rather than the primary definition of a chunk. Split long descriptions at semantic boundaries such as headings, paragraphs, specification tables, and list sections.
For a long product manual or technical description, use a hierarchy:
- Create a product-level parent record.
- Split the content by meaningful headings such as Materials, Installation, Compatibility, and Care.
- Keep each section within the embedding model’s input limit.
- Add the product name and section name to every child chunk.
- Use a small overlap only when a sentence or definition crosses a boundary.
For example, a chunk titled “Trail Shell Jacket compatibility” is more useful than a fragment containing the final 500 characters of a compatibility paragraph.
When to use overlap
Overlap can preserve context across boundaries, but excessive overlap creates duplicate search results and increases storage and indexing costs. Use it selectively:
- Use little or no overlap for independent attribute, variation, and policy records.
- Use modest overlap for long narrative descriptions where adjacent paragraphs depend on each other.
- Repeat stable context such as the product name and section title instead of copying large portions of neighboring text.
A useful alternative to broad overlap is contextual prefixing. Add a short prefix such as “Trail Shell Jacket — Installation — ” to each chunk. This preserves identity without duplicating whole paragraphs.
Separate searchable text from metadata
Not every field should be embedded. Exact identifiers and filters are usually better represented as metadata:
- WooCommerce product ID and variation ID
- SKU and global unique identifiers
- Product type and post status
- Category and attribute term IDs
- Language and store or tenant ID
- Price range and stock status
- Publication date and catalog visibility
- Source revision and synchronization timestamp
Embed natural-language descriptions and normalized specifications. Keep exact SKUs available for keyword search or metadata filtering. A hybrid retriever can then handle both a query such as “waterproof hiking jacket” and an exact query such as “TSJ-001-BLU-M”.
Normalize WooCommerce fields before chunking
WooCommerce data can contain HTML, shortcodes, repeated text, inconsistent units, and values stored in custom fields. Normalize it before generating chunks:
- Remove presentation-only HTML while preserving meaningful headings and list content.
- Expand or safely process shortcodes rather than embedding unresolved shortcode names.
- Decode entities and normalize whitespace.
- Standardize units where appropriate, while retaining the original value if customers may search for it.
- Represent missing values as absent rather than inventing “not specified” repeatedly.
- Deduplicate identical descriptions inherited from templates.
- Preserve the distinction between a missing value, an empty value, and a value such as zero.
Keep the raw WooCommerce payload or a reproducible source snapshot separately. The normalized representation should be deterministic so that the same source data produces the same chunk IDs and hashes.
Example chunk-generation strategy
A production pipeline can generate chunks from a normalized product object:
function buildChunks(product) {
const chunks = [];
chunks.push(makeChunk(product, 'overview', buildOverview(product)));
if (hasDetails(product)) {
chunks.push(makeChunk(product, 'details', buildDetails(product)));
}
if (product.attributes.length) {
chunks.push(makeChunk(product, 'attributes', buildAttributes(product)));
}
for (const variation of product.variations) {
chunks.push(makeVariationChunk(product, variation));
}
if (product.policyText) {
chunks.push(makeChunk(product, 'policy', product.policyText));
}
return chunks.filter(chunk => chunk.text.trim().length > 0);
}
In an actual implementation, the builders should apply field allowlists, normalize values, escape or remove unsafe markup, and enforce token limits. The output should also include a deterministic hash of the normalized source content.
Versioning and synchronization
Product data changes frequently. Treat chunks as versioned projections of WooCommerce data rather than permanent documents.
For each chunk, store a source revision, content hash, generated timestamp, and deletion state. During synchronization:
- Fetch products and variations changed since the last successful sync.
- Normalize the current source representation.
- Generate the expected chunk set.
- Compare chunk hashes with the indexed records.
- Re-embed only new or changed chunks.
- Mark chunks that no longer exist as deleted or remove them from the vector index.
- Update the synchronization checkpoint only after the index operation succeeds.
Use stable IDs such as product-{product_id}-details and product-{product_id}-variation-{variation_id}. Avoid IDs based on array position because adding or reordering variations would make unchanged records appear new.
Handling multilingual and multi-store catalogs
Include language, site, currency, and tenant identifiers in metadata. Do not allow a result from one storefront or language to answer a query for another unless that behavior is intentional.
For translated catalogs, index the translated product content as separate language-specific chunks or use a multilingual embedding model. Always retain the source product and variation IDs so that the answer layer can link back to the correct WooCommerce record.
Retrieval and answer assembly
Chunking works best when retrieval is followed by controlled context expansion:
- Run hybrid search over chunk text and exact metadata.
- Apply filters for store, language, publication status, and catalog visibility.
- Retrieve the most relevant chunks.
- Group results by parent product when multiple chunks belong together.
- Fetch current volatile fields such as price and stock if required.
- Pass only the selected chunks and their provenance to the answer-generation step.
For example, a query about whether a blue medium jacket is available may retrieve an attribute chunk and a variation chunk. The application can combine those records, then verify current inventory before producing an answer. It does not need to send the entire product catalog or all product descriptions.
Common chunking mistakes
- One chunk per product: easy to implement, but poor for products with many variations or long descriptions.
- One chunk per field without context: produces isolated values that are difficult to interpret.
- Embedding every price and stock value: creates stale answers unless updates are frequent and reliable.
- Copying global policies into every product: increases duplication and makes policy updates harder to manage.
- Using only vector search: misses exact SKU, product ID, and attribute queries.
- Ignoring deleted products: allows discontinued or private items to remain retrievable.
- Failing to preserve provenance: makes it difficult to audit why a product answer was generated.
Evaluate chunk quality with WooCommerce questions
Build a test set from real support, sales, and merchandising questions. Include questions about product identity, specifications, variations, compatibility, policies, and unavailable products. For each question, record the expected product and the fields required to answer it.
Measure retrieval recall at several result sizes, the rate of irrelevant chunks, stale inventory responses, and whether the retrieved records contain enough context to answer without guessing. Review failures by chunk type. If variation questions fail, the issue may be missing parent context or incorrect variation serialization rather than the embedding model.
A useful operational metric is the percentage of answers that can cite a current product or variation ID. Chunking should make that provenance straightforward, not hide it inside a large undifferentiated document.