Product filter implementation works correctly
Why it matters
Filters that display but do not narrow the list, or that OR across types instead of AND, return products that violate the shopper's explicit constraints — a $0-$50 selection that still shows $120 items destroys trust on the spot. Users correlate broken filters with a broken store and leave. Faceted navigation that ignores query parameters also generates duplicate-content SEO penalties because every filter URL serves the same full catalog.
Severity rationale
Medium because broken filters silently break purchase intent across every category page and erode SEO simultaneously.
Remediation
Build the where clause conditionally so each active filter narrows the result set with AND semantics, and make sure price bounds use gte/lte rather than OR. Place the logic in src/app/api/products/route.ts:
let query: any = {}
if (categoryFilter) {
query.categories = { some: { id: { in: categoryFilter } } }
}
if (priceMin && priceMax) {
query.price = { gte: priceMin, lte: priceMax }
}
const results = await prisma.product.findMany({ where: query })
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Catalog & Product Logic Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ecommerce-catalog·automated