Category Aware Risk
5 min read
The Category-Aware Risk Scoring module catches a pattern most fraud-detection systems miss: customers whose abuse is concentrated in specific product categories rather than spread across their entire order history. A customer with a 35% overall return rate might look only mildly elevated, but if every one of those returns is from the same high-value category, that’s a different kind of signal than a customer whose returns are scattered across the catalog.
Module ID: categories. Default: enabled. Free tier (complete).
What It Observes #
The module hooks into refund and order completion events. For each event the module:
- Iterates over the line items of the order or refund
- Maps each item to its WooCommerce product category
- Updates per-category counters: orders containing the category, refunds containing the category, refund value attributable to the category
- Recomputes the customer’s per-category return rate
Per-category stats are stored in the dedicated {prefix}trustlens_category_stats table, keyed by customer hash and category slug. This is the only module that uses a separate table — others store all aggregates on the main customer row.
What It Signals #
The module compares each customer’s per-category return rate against a weighted threshold. The weight comes from a category weights map you can configure — default weight is 1.0 for all categories, but you can raise weights for high-risk categories (e.g. luxury, electronics) to make the module more sensitive there.
| Category Return Rate | Weight | Score | Reason Shown on Profile |
|---|---|---|---|
| ≥ 50% (any weight) | — | -15 to -20 | “50%+ returns in {Category}” |
| ≥ 30% | ≥ 1.5x | -10 to -15 | “Elevated category return rate ({Category})” |
| < 30% | any | 0 | (no signal) |
The signal fires once per qualifying category. A customer with elevated rates in three different categories will see three separate signals on their profile, each tagged with the category name.
The Weight System #
Category weights are how you tell the module which categories matter most. The default weight for all categories is 1.0. To make the module more sensitive in a specific category, raise the weight; to make it less sensitive, lower the weight.
Configure weights in Settings → Modules → Categories. The setting accepts a map of category slug → weight:
{
"luxury": 2.0,
"electronics": 1.8,
"shoes": 0.8,
"apparel": 0.9,
"default": 1.0
}
The default key is used for any category not explicitly listed.
Why Weights Matter #
A 35% return rate in a category like Shoes (baseline weight 0.8) does not trigger the elevated signal — shoes have naturally high return rates. The same 35% rate in Luxury (baseline weight 2.0) easily clears the 1.5x threshold and fires the signal. Without weights, the module would treat both identically and over-flag shoe-buying customers while under-flagging luxury returners.
How to Pick Weights #
The recommended approach: look at your store-wide return rate per category. Categories where the store-wide rate is significantly above your overall average should get weights < 1.0 (because elevated rates there are normal). Categories where the store-wide rate is below average and items are high-value should get weights > 1.0 (because elevated rates there are unusual and expensive).
Settings #
| Setting | Default | Description |
|---|---|---|
| Category weights | { default: 1.0 } | Per-category weight map. Keys are category slugs; values are floats. Use “default” for the fallback. |
| Module enabled | On | Master toggle |
To adjust, go to TrustLens → Settings → Modules → Categories. The UI surfaces your top WooCommerce categories so you don’t have to look up slugs manually.
Common Patterns #
The Category-Specific Wardrober #
Signature: Customer has 8 orders, 4 refunds. All 4 refunds are from “Cocktail Dresses.” Overall return rate looks moderate (50%), but the category concentration is 100%.
Signals: Categories fires -15 to -20 for the dress category. Returns fires -25 for the high overall rate. Wardrobing signal may also fire.
Profile: Risk or Critical. The category signal is the smoking gun.
The Defective Product Cluster #
Signature: Many different customers show elevated return rates in the same category. The category-wide store return rate is elevated.
Detection: Look at the Category Abuse Stats dashboard card — it shows store-wide per-category return rates. A category showing 38% store-wide returns indicates a product issue, not customer abuse.
Action: Investigate the SKUs in the category. Don’t penalize customers for legitimate returns of defective items. Consider lowering the weight for that category temporarily until the underlying issue is fixed.
The High-Value Item Returner #
Signature: Customer with a moderate overall return rate but all returns concentrated in a high-priced category.
Detection: If you’ve set a higher weight for that category, the signal fires earlier and harder than the overall return rate would.
Profile: Caution to Risk depending on the magnitude.
How the Calculation Works #
Step by step for a single customer:
- Module reads the customer’s per-category stats from
{prefix}trustlens_category_stats - For each category where the customer has at least 3 orders touching that category, compute return_rate = refunds_in_category / orders_in_category
- Look up the category’s weight from the settings (defaulting to 1.0)
- If weight × return_rate ≥ 0.75 (i.e. weight=1.5 × rate=50% or higher), apply the high-tier signal
- If return_rate ≥ 0.50 (any weight), apply at minimum the medium-tier signal
- Emit one signal per qualifying category
The 3-order minimum per category prevents firing on customers who happened to buy and return a single item from a category.
The Category Abuse Stats Dashboard Card #
The Dashboard’s Category Abuse Stats card aggregates Category-Aware Risk data at the store level. It shows:
- The top 5 categories by store-wide return rate
- The number of customers with elevated rates in each
- The total refund value attributable to each category
Use this card to distinguish customer-side abuse from product-side issues. If a single category has a 40% store-wide return rate, the issue isn’t your customers — it’s the products. Fix the products before blocking the customers.
False-Positive Watch List #
- Wide categories with mixed product quality. A category like “All Sale Items” lumps together products with very different return profiles. Use more specific categories where possible.
- Recently-restocked categories with bad batches. A defective batch can spike returns for a few weeks. Tune the weight down temporarily.
- Customers who only ever buy from one category. If a customer’s entire 50-order history is in one category, even a 10% rate there is over-represented. Look at the absolute return count, not just the rate.
- Mis-categorized products. If product taxonomy is messy, signals may fire on weird categories. Audit the WooCommerce category tree before tuning weights.
Disabling the Module #
Reasonable to disable if your store has a single product category (it produces no useful signal) or if your category taxonomy is so messy that signals fire on noise. When disabled, per-category stats stop updating; the underlying table is preserved.
Reading the Categories Section of a Profile #
- Signal breakdown lists one signal per qualifying category
- Per-category stats panel shows orders, refunds, and return rate broken out by category
- Event timeline shows refund events with the categories of the refunded line items
For a customer with three elevated categories, you’ll see three “Categories” signals in the breakdown, each naming a specific category. This makes it obvious which products the customer is having issues with.
Interaction with the Returns Module #
Categories and Returns are designed to be complementary, not duplicative:
- Returns looks at overall return rate — answers “is this customer above the store-wide threshold?”
- Categories looks at where returns concentrate — answers “are this customer’s returns unusual within specific categories?”
A customer can be flagged by both modules independently. A customer might also be flagged by Categories but not Returns (if their overall rate is moderate but heavily concentrated) — that’s a real signal Categories is designed to catch.
Together, the two modules produce a clearer picture than either alone: Returns tells you the magnitude, Categories tells you the shape.