Default chunking is a useful starting point, but WooCommerce knowledge bases often contain structures that generic rules cannot preserve reliably. Product specifications, shipping conditions, refund policies, subscription terms, and developer documentation each need different boundaries. Apply your own chunking rules when the meaning of a retrieved passage depends on a structure that the default parser or splitter is likely to break.
Use default chunking when the content is already coherent
Start with the chunking behavior provided by your LlamaParse and Undefined workflow when documents are short, consistently formatted, and written as ordinary prose. A well-structured blog post, a short implementation guide, or a simple FAQ may retrieve accurately without custom handling.
Before changing the rules, test representative questions rather than judging chunks by size alone. For example, ask whether a support query about delayed shipping returns the complete delivery condition, including the qualifying region, processing time, and exception. If the answer is consistently complete, custom rules may add complexity without improving retrieval.
Apply custom rules when boundaries carry meaning
Custom chunking is justified when splitting at a fixed character or token length separates information that must be interpreted together. Common WooCommerce examples include:
- Product variations: Keep an attribute, its available values, and its pricing or stock note together.
- Shipping rules: Keep the destination, order threshold, delivery estimate, and exclusions in one retrievable unit.
- Refund policies: Preserve the eligibility condition with its time limit and required customer action.
- Subscription documentation: Keep renewal, cancellation, pause, and failed-payment behavior associated with the relevant plan or section.
- Developer documentation: Keep an endpoint, request parameters, authentication requirements, and response example together where possible.
Recognize the main signals
Tables lose their row context
Tables frequently need special treatment. A parser may extract cells as a sequence of text, but a later chunk split can separate the column headings from the values. A shipping-rate table is not useful if the retrieved passage contains “$9.95” without the destination, weight range, or service name.
For important tables, convert each row into a self-contained statement before embedding it, or attach the table heading and column names to every row. For example, a row can become “Canada, standard shipping, orders under $100, delivery in 5–8 business days, cost $14.95.” This is usually more searchable than embedding an isolated sequence of cell values.
Headings define scope
A heading such as “Digital products” or “United States” changes the meaning of the paragraphs below it. If a chunk contains the paragraph but not the heading, a retrieval result may look correct while omitting the scope that makes it applicable.
When headings carry scope, prepend the heading path to each chunk. A useful path might be “Shipping > International > Canada > Duties and taxes.” The path can remain in the chunk text or be stored as metadata, but including it in the searchable text often helps queries that mention only the category or region.
Lists contain conditions and actions
Numbered procedures and bulleted requirements should not be split arbitrarily. A checkout troubleshooting procedure may require the reader to complete step one before step two, while a refund checklist may require all items. Keep the list introduction with its items, and keep a short list intact when its total size permits.
Repeated templates create noise
Store exports, invoices, and product feeds can contain repeated navigation, footer text, boilerplate disclaimers, or duplicated product labels. If these elements consume most of each chunk, retrieval quality suffers and the same irrelevant text is repeatedly returned.
Remove or isolate repeated boilerplate only after confirming that it is not legally or operationally important. Store the original document identifier, page, section, or product ID as metadata so the source remains auditable even when the embedding text is normalized.
Choose rules based on the question, not the document type alone
Two documents with the same file extension may require different strategies. A PDF containing a marketing article can use paragraph-aware splitting, while a PDF containing a rate card may need row-aware extraction. Define rules around the questions the WooCommerce team must answer:
- Collect real support, sales, and developer questions.
- Identify the smallest passage that can answer each question correctly.
- Check whether the default chunks preserve the required conditions and scope.
- Add a custom rule only for the structure that fails.
- Re-run retrieval tests after every rule change.
This approach avoids creating very large chunks merely because a document appears complex. The goal is not to preserve every visual boundary. The goal is to produce passages that are independently understandable and sufficiently specific for retrieval.
Use different rules for different content classes
A practical ingestion pipeline can classify content before chunking. For example, product data may use product- or variation-level records, policy pages may use heading-aware sections, and API references may use endpoint-level sections. Keep the classification explicit so later changes are testable.
const rules = {<br> product: { boundary: 'product-or-variation', include: ['title', 'attributes', 'price', 'stock'] },<br> policy: { boundary: 'heading-section', include: ['heading-path', 'conditions', 'exceptions'] },<br> api: { boundary: 'endpoint', include: ['method', 'path', 'parameters', 'response-example'] }<br>};
The exact implementation depends on the parser and storage layer. LlamaParse can provide structured document content, but the downstream application still needs to decide which units should become chunks and which fields should become metadata. Undefined should receive consistent records rather than a mixture of arbitrary text fragments and unlabelled excerpts.
Do not overfit chunk size
Custom boundaries do not eliminate the need for a size limit. A single product manual section, terms page, or API endpoint can still be too large for efficient retrieval. When a logical unit exceeds the limit, split it at the next safest boundary: subsection, procedure step, table group, or paragraph. Repeat the relevant heading path and entity identifier in each child chunk.
Use small overlap only when adjacent context is genuinely needed. Excessive overlap can duplicate policy clauses, inflate the index, and cause the same answer to appear several times. For WooCommerce catalogs, stable identifiers such as product ID, variation ID, SKU, locale, and document version are often more valuable than large overlap windows.
Validate custom rules with failure-focused tests
Measure whether a rule keeps the answer together, not simply whether it produces a preferred average chunk length. Include tests for regional exceptions, minimum-order thresholds, variation-specific stock, cancellation deadlines, and similarly named products. Also test negative cases: a query about digital downloads should not retrieve a physical-shipping rule just because both chunks contain the word “delivery.”
For every retrieved result, verify four properties:
- The passage contains the applicable entity or section.
- The conditions and exceptions are present.
- The source location and version can be identified.
- The passage does not merge conflicting rules from different products, regions, or dates.
Apply your own chunking rules when these checks show that generic splitting is destroying scope, relationships, or operational conditions. Keep the default behavior for content that already retrieves well, and introduce the smallest targeted customization that fixes the observed failure.