DEV Community

Cover image for Why We Replaced WordPress with Next.js 16 for High-Traffic E-Commerce in Morocco
Omar Amassine
Omar Amassine

Posted on Originally published at triplew.ma AI-assisted

Why We Replaced WordPress with Next.js 16 for High-Traffic E-Commerce in Morocco

In emerging and mobile-dominant markets like Morocco, web performance is not just a technical vanity metric—it is the single biggest determinant of e-commerce revenue and cart completion.

Over 78% of local online transactions occur on mobile 4G/3G connections. Yet, the vast majority of digital agencies still deploy monolithic WordPress/WooCommerce themes loaded with 35+ plugins, averaging 3.5 to 5.2 seconds for First Contentful Paint (FCP).

Here is why our engineering team at TripleW shifted our entire production stack to Next.js 16 (Turbopack, App Router) and Cloud Edge Architecture, and the real-world benchmarks we achieved.


1. The Real Cost of Slow Mobile Speeds

When a mobile shopper in Casablanca, Rabat, or Marrakech clicks an Instagram Ad, every 100ms delay exponentially increases bounce rates:

  • At 1.0s LCP: Average conversion rate sits at ~3.2%.
  • At 3.5s LCP (Standard WordPress): Conversion drops to under 1.1%.
  • At 5.0s+: Over 54% of mobile visitors abandon before the hero image renders.

To help merchants quantify this direct revenue drain in Moroccan Dirhams (MAD), we built an open interactive tool:
👉 Mobile Speed Loss & ROI Calculator


2. Benchmark: Next.js 16 vs. Monolithic WordPress

We benchmarked a 5,000-SKU catalog migrated from WooCommerce to Next.js 16 with static generation (generateStaticParams) and incremental cache invalidation:
We benchmarked a 5,000-SKU catalog migrated from WooCommerce to Next.js 16 with static generation (generateStaticParams) and incremental cache invalidation:

Metric Monolithic WordPress Next.js 16 on Cloud Edge Improvement
Largest Contentful Paint (LCP) 3,840 ms 680 ms -82%
Interaction to Next Paint (INP) 240 ms 28 ms -88%
Cumulative Layout Shift (CLS) 0.18 0.00 Perfect 100
Server Response (TTFB) 850 ms 45 ms 18x faster
Security Surface High (Plugins/PHP) Zero-Plugin Attack Surface Enterprise Grade

3. Seamless Integration with Local Payment Gateways (CMI)

One of the biggest pain points in the Moroccan market is online card processing via CMI (Centre Monétique Interbancaire).

Legacy CMS setups often suffer from:

  1. Failed webhook confirmations due to PHP execution timeouts.
  2. Clunky redirect flows that drop mobile users during 3D-Secure 2.0 verification.
  3. Lack of seamless automated fallbacks to WhatsApp CRM for Cash on Delivery (COD) confirmation.

With Next.js API route handlers and server actions, bank transactions are confirmed within milliseconds with full cryptographic signature verification.

For a full technical breakdown of the integration architecture:
👉 CMI Online Payment Integration Guide


4. Key Takeaways

If you are building digital products in North Africa or high-growth emerging regions:

  • Mobile-First is Edge-First: Ship pre-rendered static HTML with minimal client JS bundles.
  • Eliminate Plugin Debt: Custom bespoke interfaces outperform bloated page builders every time.
  • Invest in GEO & AI Search Readiness: Ensure your structured data (JSON-LD) and llms.txt endpoints are primed for generative AI crawlers.

Explore more case studies and client architectures at TripleW Digital Studio.

Top comments (4)

Collapse
 
erlanggasatriasource profile image
Erlangga Satria •

maybe you should built on your own system on php than using wordpress, its always more solid speed and money still php winning, you could try built system from zero, for reactivity just use htmp, its using web api, why size so tiny 3.6kb gzip, and with code for app app.js + htmp maybe around 10-20kb. all server render no hydration concept, this benchmark on low end android phone redmi a5 below $100 price, 100-150ms, with all app and game and memoty full just try with low end android phone in Moroco what number to reactive 1000row table, tell me the result,

Collapse
 
amsomr profile image
Omar Amassine • • Edited

Thanks for sharing your perspective and congratulations on building HTMP—a 3.6 kB footprint with zero hydration is definitely an impressive achievement for CPU and memory-constrained devices!

You raise a very valid point regarding low-end hardware: in emerging markets like Morocco, budget Android devices (often running on throttled 4G or unstable 3G) are the primary entry point for e-commerce shoppers. Minimizing main-
thread CPU execution and client-side JavaScript is non-negotiable.

Here is why we chose the Next.js 16 (App Router + RSC) architecture over building a custom PHP-from-scratch system for this specific enterprise scale:

  1. Server-First with React Server Components (RSC): With Next.js 16 and RSC, the majority of the page (catalog grids, product descriptions, layouts) is rendered as pure HTML on the server and streamed down. We only hydrate tiny, isolated interactive leaves (like the cart drawer or variant selector). This drastically limits client JS execution on low-end devices while giving us streaming SSR and instant First Contentful Paint.
  2. End-to-End Type Safety & Data Integrity: E-commerce at this volume connects to legacy ERPs, Moroccan payment gateways (CMI, PayZone), real-time inventory systems, and fulfillment APIs. Having unified TypeScript schemas (Zod, tRPC/Server Actions) across the entire pipeline prevents runtime regressions and transaction discrepancies that often plague custom zero-framework setups.
  3. Developer Velocity & Long-Term Maintainability: Building a bespoke PHP engine from scratch ("from zero") delivers raw execution speed, but introduces high maintenance debt, bespoke security auditing overhead, and friction when onboarding new engineers. Using an established modern ecosystem allows client engineering teams to scale, hire, and maintain the codebase sustainably.
  4. Shared Multi-Platform Mental Model: At TripleW Digital, our team builds both high-performance web storefronts and mobile apps (Flutter / React Native). Having standardized API contracts, shared validation logic, and unified state architecture between web and mobile saves hundreds of engineering hours.

That said, I love the resurgence of hypermedia-driven architectures (HTMX, HTMP, Alpine, islands architecture). For lightweight content hubs, local storefronts, or micro-tools, that approach is razor-sharp.

Keep up the great work on HTMP!

Collapse
 
erlanggasatriasource profile image
Erlangga Satria •

ok thank you for explanation, yah we talked many idea, many new framework, but we know facebook no migration to next, still php hack, maybe I should made a new skill to LLM so they automatic made MPA to SPA smooth then made new type of syntax for mobile app

Thread Thread
 
amsomr profile image
Omar Amassine •

Thanks, Erlangga! Meta’s infrastructure with Hack definitely proves how far tailored server architecture can be pushed. Teaching LLMs to automate smooth MPA-to-SPA state transitions and mobile patterns is an intriguing direction. Wishing you the best with the project!