Case Study

Full-stack e-commerce automation for a DTC leather brand in Pakistan

A fast-growing Shopify store was losing money on every COD return and spending hours on manual order tracking. We built five interconnected systems that eliminated the manual work entirely.

Industry DTC Fashion / Leather Goods
Platform Shopify
Region Pakistan (nationwide COD)
Engagement Summary
5
Systems built
4 wks
Engagement
0 hrs
Manual work / day
2x
Daily auto-syncs
SEO health score
38
82
Before → After (target)

Cash-on-delivery is how Pakistan shops. It is also how stores lose money.

The brand was processing 50+ daily orders, nearly all COD. Three recurring problems were eating into margins and consuming hours of staff time every day.

🚚

Ghost deliveries

Couriers would attempt delivery, find no one home, and return the parcel. The store paid shipping both ways on orders that were never real. No system existed to confirm intent before dispatch.

💳

Manual payment tracking

When a COD order was delivered, someone had to manually log into the courier portal, cross-reference the order, and mark it as paid in Shopify. For 50+ daily orders, this consumed 2-3 hours.

🔍

Zero delivery visibility

The team had no idea where orders were after handoff to the courier. Customer inquiries about delivery status required logging into a separate portal and searching manually.

Five systems, one automation layer

Each system runs independently but they share data. Together, they form a complete operations layer that handles delivery, payment, customer communication, and online visibility without manual intervention.

Systems Delivered
01 Courier-to-Shopify delivery sync
02 Automatic COD payment capture
03 Prepayment incentive engine
04 WhatsApp order confirmation
05 SEO audit + B2B content strategy
New Order
WhatsApp Confirm
Courier Dispatch
Delivery Sync
Auto Payment
Email Report

A Python service runs twice daily (9 AM and 6 PM local time), pulling live courier data via the courier’s API and writing the latest status directly into each Shopify order — tags, notes, and timeline events.

  • Every active order is checked against the courier’s tracking system
  • Statuses mapped: In Transit, Out for Delivery, Delivered, Attempted, Returned
  • Full delivery history added to Shopify order notes
  • Returned shipments flagged immediately for resolution
  • Resolved orders are permanently skipped to avoid wasted API calls
Shopify Orders. Live View
#71502
PKR 4,698 · COD
Delivered
#71498
PKR 3,250 · COD
Out for Delivery
#71490
PKR 5,100 · COD
Attempted
#71441
PKR 3,900 · COD
Returned

The moment the courier confirms delivery, the system automatically records the COD payment against that order in Shopify. Revenue reflects reality in real time.

  • Payment captured at the exact order amount, no rounding, no manual errors
  • Only COD orders are processed. prepaid orders are never touched
  • Cancelled and returned orders are protected from accidental payment
  • Full audit trail: payment timestamp, courier confirmation, and order tag added simultaneously
Order #71502. Payment
Payment Status
Paid
PKR 4,698.00 · Captured automatically
Timeline
● Courier confirmed delivery. 6:02 PM
● Payment captured automatically. 6:02 PM
● Order tagged Delivered. 6:02 PM

At checkout, customers are automatically offered a 10% discount for paying via bank transfer instead of cash on delivery. No discount codes, no friction. the incentive is built directly into the checkout experience.

  • 10% discount applied instantly when bank transfer is selected
  • Promotional banner appears at the payment step
  • COD option hidden once prepay is selected to prevent switching back
  • Every prepaid order eliminates return risk entirely. cash received before anything ships
  • Custom Shopify Liquid templates handle the logic without apps
Checkout. Payment Step
Cash on Delivery
Pay on arrival
Bank Transfer
Save 10% on your order
10% OFF
Pay via bank transfer and save 10% instantly
Order total
PKR 5,500 PKR 4,950

Every new COD order triggers an instant WhatsApp message to the customer. They reply YES to confirm or NO to cancel. No reply within 24 hours means automatic cancellation. No courier is dispatched to a ghost customer.

  • Sent within seconds of order placement via Meta WhatsApp Business API
  • Bilingual message. English and Urdu in one message
  • YES/NO keyword detection handles replies automatically
  • Silent orders cancelled and inventory restocked after 24 hours
  • Built as a Flask microservice with Supabase for state management
WhatsApp. Order Confirmation
Hello Sara / السلام علیکم

Your order #71502 worth PKR 4,698 has been placed.

Reply YES to confirm.
Reply NO to cancel.
6:00 PM · ✓✓
YES → Confirmed ✓
NO → Cancelled ✗
No reply after 24h → auto-cancelled

A comprehensive audit uncovered why the store was invisible to both Google and AI search engines. We identified 38 issues across technical SEO, content quality, schema markup, and performance. then built a prioritized action plan and produced the first wave of B2B content to open a wholesale channel.

  • Overall SEO health score: 38/100 at audit, target 82/100 after fixes
  • All rich results were blocked. schema used http:// instead of https://
  • Hero image lazy-loaded (LCP > 4s). fixed for immediate Core Web Vitals improvement
  • Two major collection URLs returning 404. redirects created
  • Created 3 B2B landing pages (wholesale, custom, corporate) and 5 SEO blog posts
  • Prioritized 50+ fixes across Critical, High, Medium, and Low tiers
SEO Audit. Score Breakdown
Technical SEO
61 / 100
Content / E-E-A-T
42 / 100
On-Page SEO
32 / 100
Schema / Structured Data
20 / 100
Core Web Vitals
30 / 100
AI Search Readiness
31 / 100
Overall
38 / 100 → target 82

The order lifecycle, fully automated

From the moment a customer places an order to the moment revenue is confirmed, every step runs without human input.

Customer places COD order on Shopify

Shopify webhook fires immediately, triggering the WhatsApp confirmation system.

Instant

WhatsApp message sent to customer

Bilingual confirmation request sent via Meta API. Customer replies YES or NO. No reply after 24 hours triggers automatic cancellation and inventory restock.

Within seconds

Confirmed order dispatched to courier

Only confirmed orders move to fulfillment. Ghost customers are filtered out before any shipping cost is incurred.

Delivery sync runs twice daily

At 9 AM and 6 PM, the Python service queries the courier API and updates every active order in Shopify with the latest status, notes, and tags.

9 AM & 6 PM

Courier confirms delivery

The sync detects the delivery confirmation and automatically marks the COD payment as captured in Shopify. Revenue is recorded instantly.

Automatic

Daily summary email sent to team

After each sync, a clean report lands in the owner’s inbox, orders delivered, payments captured, returns flagged, items still in transit.

2x daily

What changed after deployment

Measurable improvements across operations, revenue accuracy, and team capacity.

Operations

0 hours/day on manual tracking

The team previously spent 2–3 hours daily cross-referencing courier portals and updating Shopify. That work is now fully automated.

Revenue Accuracy

100% COD payment reconciliation

Every delivered COD order is automatically marked as paid at the exact amount. No orders slip through, no manual data entry errors.

Return Prevention

Ghost orders filtered before dispatch

WhatsApp confirmation prevents shipping to customers who never intended to accept delivery. Unconfirmed orders are cancelled before courier pickup.

Visibility

Real-time delivery tracking in Shopify

Every order shows its latest courier status directly in Shopify, no external portal logins required. Customer service can answer status questions in seconds.

SEO

38 → 82 SEO health score (target)

Critical fixes deployed: schema corrected to unlock rich results, hero image LCP fixed, broken collection URLs redirected, 8 pieces of B2B content published.

Scalability

System scales from 50 to 5,000 orders/day

The automation layer handles the same workload whether the store processes 50 orders or 5,000. Growth no longer requires proportional headcount.

What powers it

Backend

Python · Flask · Supabase (PostgreSQL) · Heroku · APScheduler for cron jobs

Integrations

Shopify Admin API · Courier tracking API · Meta WhatsApp Business API · SMTP email

Frontend

Shopify Liquid (theme customization) · Custom checkout scripts · SEO schema (JSON-LD)

Running a similar operation?

If your product brand is losing money on COD returns, spending hours on manual order tracking, or invisible on search. we have built systems that solve exactly these problems.

Book a Free Discovery Call →
Scroll to Top