All Case Studies
AI & Retail Case Study

AI-Powered Smart Ordering: 32% Less Waste, Zero Stockouts

How we built a machine learning inventory system that predicts exactly how much perishable stock to order - eliminating the guesswork that costs franchise retailers thousands in wasted food every month.

The Results at a Glance

Real numbers from a live retail franchise operation

32%

Less Food Waste

AI-optimised order quantities

~0%

Stockout Rate

Shelves stay full

2hrs

Saved Daily

Ordering takes minutes, not hours

60+

Departments Managed

Hundreds of perishable SKUs

The Challenge: The Perishable Stock Tightrope

Our client operates a franchise store for one of South Africa's largest national retailers - a household name with thousands of locations across the country. Their specific challenge? They're a convenience-format store specialising in fresh, perishable food: sandwiches, salads, ready meals, dairy, baked goods, and fresh produce - all with shelf lives measured in days, not weeks.

Every single day, the store manager needs to place an order for the next delivery. Order too much, and food expires on the shelf - pure waste that eats directly into margins. Order too little, and customers walk away empty-handed. For a franchise store with tight targets, this daily balancing act was consuming hours and still getting it wrong.

The core problem: With hundreds of perishable products across 60+ departments, each with different shelf lives, sales patterns, and seasonal trends - no human can consistently make optimal ordering decisions using gut feel and a spreadsheet. The store was running at 5-7% waste when the target was under 3%.

Specific Pain Points We Needed to Solve

Daily Ordering Was a 3-Hour Guessing Game

The manager would review the retailer's suggested quantities, manually adjust each one based on memory and gut feel, and hope for the best. A single bad call on chicken or sandwiches could mean R2,000+ in waste.

No Visibility Into Usage Patterns

How much macaroni and cheese do you sell on a Wednesday vs. a Friday? What happens to salad sales when it rains? Nobody knew - there was no historical data analysis, just experience and intuition.

Delivery Discrepancies Went Untracked

Ordered 10 cases, received 7 - but nobody knew until a customer complained. Short deliveries were common, but without tracking, the store couldn't hold anyone accountable or plan around the gaps.

Near-Expiry Stock Had No Recovery Channel

Products approaching expiry were simply written off as waste. There was no system to discount and sell them to regular customers who'd happily buy at a lower price - money literally thrown in the bin.

The POS Data Was Trapped

The legacy point-of-sale system stored valuable sales history in old-format database files that nobody could read. Years of usage data sitting unused.

The Solution: AI That Learns How Your Store Sells

A complete ordering intelligence platform built from the ground up

We didn't just build a prettier spreadsheet. We built a full-stack ordering intelligence system with two AI engines working in parallel - one rule-based for speed and transparency, one machine learning model for pattern discovery - that integrates directly with the retailer's existing ordering API.

How the AI Forecasting Works

The system runs two independent prediction engines and presents both results side-by-side, letting the manager choose or blend recommendations:

1

Ingest History

Imports months of sales data from the POS system and tracks every unit sold, wasted, or delivered - broken down by day of week.

2

Analyse Patterns

Exponential smoothing identifies day-of-week trends. The ML model (Facebook Prophet) detects seasonality, holidays, and weather impact.

3

Adjust for Context

South African payday periods (25th-28th), public holidays, weather forecasts, and active promotions all modify the baseline prediction.

4

Learn from Results

Every delivery is fed back into the model. Over/under predictions are tracked, and the AI adjusts its confidence and suggestions automatically.

The smart part: The AI distinguishes between controllable waste (overstock, expiry) and uncontrollable waste (damaged goods, supplier quality issues). It only reduces order quantities for waste that's actually within the store's control - so you don't get penalised for a bad batch from the supplier.

Key Features We Built

Every feature solves a real problem the store faced daily

Smart Daily Ordering

The core workflow. Syncs the upcoming week's delivery schedule directly from the retailer's API, shows AI-adjusted quantities alongside the retailer's own suggestions, and lets staff submit the final order with one click. Products are grouped by department with inline barcode scanning to quickly find any item.

Dual AI Engine

A fast, transparent rule-based engine (exponential smoothing, shelf-life capping, trend detection) runs alongside a Python ML backend powered by Facebook Prophet with weather and holiday regressors. Both provide confidence levels and human-readable reasoning for every suggestion.

Delivery Tracking & Short Detection

When a delivery arrives, staff scan and record what was actually received. The system automatically flags shorts (ordered but not delivered) and repicks (substitutions). Order snapshots preserve the original quantities so nothing gets lost when the retailer's system overwrites data.

Waste Sales Recovery System

Near-expiry items are listed for discounted sale to regular customers via WhatsApp. Staff paste the WhatsApp conversation, and a fuzzy-matching parser automatically allocates products to customers fairly. The system learns name aliases over time (e.g. "Mac n Cheese" = "Macaroni & Cheese") and tracks customer preferences.

Rich Analytics Dashboard

Interactive dashboards covering sales trends, waste analysis by category and reason, order vs. delivery fulfilment rates, and AI prediction accuracy. The manager can see at a glance if waste is trending up, which departments need attention, and how the AI's suggestions compare to actual results.

Legacy POS Data Import

A custom parser reads the retailer's legacy dBase III/IV files (.DBF format) - product catalogues, transaction history, waste records, and delivery logs. Drag-and-drop upload with automatic deduplication. This unlocked years of historical data that was previously inaccessible.

Before & After

The transformation in daily operations

Before

  • 2-3 hours daily on ordering
  • 5-7% waste rate on perishables
  • Order quantities based on gut feel
  • No visibility into delivery shorts
  • Near-expiry stock thrown away
  • Historical data trapped in legacy files
  • No analytics or trend visibility

After

  • 15-20 minutes to review and submit
  • Under 3% waste - within target
  • AI-driven suggestions with confidence levels
  • Every short delivery logged and tracked
  • Waste sales recovering 40%+ of near-expiry value
  • Full historical data imported and analysed
  • Real-time dashboards for every metric

The Tech Stack

Modern, scalable, and purpose-built for real-time retail operations

React 19

Frontend SPA

Vite

Build tooling

Supabase

Database & Auth

Python / FastAPI

ML Backend

Facebook Prophet

Time-series ML

Vercel

Hosting & API

html5-qrcode

Camera scanning

Recharts

Data visualisation

Architecture note: The system integrates directly with the retailer's proprietary ordering API via serverless proxy functions. This means orders placed in our system are submitted directly to the retailer's backend - no double data entry, no copy-paste, no manual syncing. The staff member reviews the AI suggestions, adjusts if needed, and hits submit.

Under the Hood: The Intelligence Layer

The ordering AI isn't a black box. Every suggestion comes with a confidence rating (high, medium, or low) and a plain-English explanation of why it's recommending that quantity. Here's what it considers:

The Rule-Based Engine (Fast & Transparent)

  • Day-of-week patterns: Uses exponential smoothing (alpha 0.3) on historical usage by weekday. Friday sandwiches vs. Monday sandwiches are completely different predictions.
  • Shelf-life capping: Never suggests ordering more than the store can sell before the product expires. A 3-day shelf life item gets a tighter cap than a 14-day item.
  • Payday awareness: South African payday (25th-28th) automatically boosts expected demand by 15%.
  • Trend detection: Compares the last 2 weeks against the prior 2 weeks. If usage is trending up or down, the AI adjusts its baseline.
  • Smart waste analysis: Tracks waste by reason - only penalises order quantities for controllable waste (overstock, expiry), not damage or quality issues.
  • Variability awareness: If a product's usage is highly unpredictable (high coefficient of variation), the AI flags it as low-confidence so the manager pays extra attention.

The ML Engine (Pattern Discovery)

  • Facebook Prophet model: Captures yearly and weekly seasonality in multiplicative mode - perfect for retail data where peaks scale proportionally.
  • Weather integration: Pulls live weather forecasts from OpenWeatherMap. Hot day? More cold drinks and salads. Rainy day? More comfort food.
  • Holiday awareness: South African public holidays are baked in as special events with their own predicted impact on sales.
  • Promotion handling: When a product is on promotion, the model applies a configurable demand multiplier (default 1.5x) to avoid stockouts during the campaign.
  • Confidence intervals: Returns 95% prediction intervals, giving the manager a clear "best case / expected / worst case" range.

Feature Spotlight: Waste Sales Recovery

One of the most impactful features we built wasn't about preventing waste - it was about recovering value from waste that was already going to happen. The store had a loyal WhatsApp group of local customers who loved buying near-expiry items at a discount. But managing it was chaos.

How It Works

1. Staff lists available items

Products approaching expiry are scanned in via barcode or selected from the catalogue. Available quantities are tracked in real-time.

2. Customers request via WhatsApp

Regular customers send messages like "I'd like 2x mac and cheese and a chicken salad." The requests come in via a WhatsApp group.

3. AI parses and allocates

Staff paste the entire WhatsApp conversation into the system. A fuzzy-matching parser identifies customers, products, and quantities - even handling informal names like "Mac n cheese" or "2x chicken." When demand exceeds supply, it allocates fairly.

4. System learns and improves

Approved product name aliases are stored and reused. Customer preferences are tracked - the system learns that Mrs. Johnson always wants the espetadas on Fridays. It gets smarter with every use.

The impact: Instead of writing off near-expiry stock at a total loss, the store now recovers 40%+ of the value through discounted waste sales. For a store handling hundreds of perishable items daily, this adds up to significant savings every month - turning a cost centre into a revenue recovery channel.

Built for a Real Team

The system isn't a one-person tool. It was designed for the full store team with role-based access control:

Admin

Full access to ordering, analytics, imports, user management, and system configuration. Typically the store manager or owner.

Supervisor

Access to stock imports and waste sales operations. Designed for shift supervisors who handle deliveries and daily waste management.

Viewer

Read-only access to dashboards and reports. Perfect for franchise owners who want visibility without the ability to modify orders.

The Outcome

What started as "we need help with our daily orders" turned into a comprehensive operational intelligence platform. The system now manages the entire lifecycle of perishable stock - from AI-assisted ordering, through delivery verification, to waste recovery.

Key results after deployment:

  • Waste dropped from 5-7% to under 3% - comfortably within the franchise target
  • Daily ordering time reduced from 2-3 hours to 15-20 minutes
  • Stockouts virtually eliminated - the AI catches patterns humans miss
  • Delivery shorts are now tracked and reported, enabling accountability
  • Waste sales programme recovers significant value from near-expiry stock each month
  • Management has real-time visibility into every metric that matters

The system is now being used daily in a live franchise environment, processing hundreds of product decisions across 60+ departments. The AI continues to learn and improve with every order, every delivery, and every piece of feedback from the team.

This kind of intelligent, integrated business system is exactly what we build at Verto Media. Not generic software forced into your workflow - but custom solutions engineered around the way your business actually operates.

Ready to Build Something Like This?

Whether it's inventory management, AI-powered forecasting, or a completely custom business system - we'll build it around your operations, not the other way around.

View More Case Studies

No obligation | Free consultation | Custom strategy

Book Your Free Strategy Call

Choose a time that works best for you. We'll discuss your goals and how we can help.