Skip to content
DEV BY SALDEV BY SAL
Case studiesLoblaws
LoblawsGrocery Retail / E-commerce2025

Real-time substitution intelligence for PC Express

Loblaws PC Express runs at a scale where a single percentage point of "rejected substitution" costs millions of dollars in lost basket value. We shipped a real-time substitution intelligence service that picks better stand-ins mid-pick, cutting customer-initiated rejection by 17% across a national rollout.

Substitution rejection
↓ ~17%
Stores live
~1,400
Decisions/day
6M+
p95 latency
<80ms
0.98S

The brief

For online grocery, the moment a personal shopper picks up the customer's order, the application stops being a website and starts being an operations product. Every out-of-stock SKU is a real-time decision: pick a substitute, ask the customer, or skip the item entirely. Loblaws was losing customers at this exact moment.

The bet: a real-time scoring service that learns from acceptance history across millions of orders can choose substitutes that customers overwhelmingly accept — without slowing the shopper down or requiring a new app for the shopper to learn.

What we built

A standalone substitution intelligence service in Go, sitting on the hot path between the shopper's handheld and the order. When the shopper marks a SKU out-of-stock, the service returns a ranked substitute list inside 80 milliseconds at p95, scored against:

  • Customer-level history (what this customer has accepted before).
  • Order-level context (what else is in the basket; what dietary signal it implies).
  • Store-level inventory (what is genuinely on the shelf right now).
  • Category-level acceptance baselines (what anyone accepts as a substitute for this SKU).

The shopper sees the top suggestion as a single tap. The customer sees, in their app, the explicit reasoning behind the substitution and a one-tap reject — which feeds back into the model.

Roll-out was instrumented as a city-by-city A/B against the legacy heuristic, so the lift was measured under real load, not in a back-test.

Outcome

Customer-initiated substitution rejection dropped by ~17% across the national footprint of roughly 1,400 stores. The service handles 6 million substitution decisions a day, well under its latency budget. Basket abandonment from "too many substitutions" — the legacy worst-case — fell from a meaningful tail behavior to a rounding error.

The model retrains nightly on the previous day's acceptance signal, keeping it adaptive to seasonality and promotional shifts without manual tuning.

"Substitution was one of the few places where we were silently losing customers every weekend. It is now one of the places we're winning them."