尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證正在載入完整 README。 以下為已儲存的摘錄。
A headless e-commerce storefront that connects Next.js on the frontend to WooCommerce on the backend — delivering the performance and reliability of the world's most popular e-commerce engine.
• What Is This?
• For Business & Product Owners
• For Digital Marketers & Analysts
• For Developers & WooCommerce Specialists
• Quick Start
• Project Structure
• Environment Variables檢視完整 README ↗A headless e-commerce storefront that connects Next.js on the frontend to WooCommerce on the backend — delivering the performance and reliability of the world's most popular e-commerce engine.
This is a headless WooCommerce storefront — WooCommerce runs silently in the background managing products, inventory, orders, and shipping, while Next.js powers the entire customer experience: browsing, search, cart, checkout, and order confirmation.
The result: a fast, modern shopping experience without abandoning the WooCommerce ecosystem your team already knows.
Key capabilities at a glance:
| Feature | Implementation |
|---|---|
| Product catalog & search | WooCommerce Store API + ISR |
| Cart & checkout | Zustand + Server Actions + WC Store API |
| Payments | Stripe Checkout + webhook order sync |
| Analytics | Full GA4 Enhanced Ecommerce via GTM |
| Performance | React, ISR, SSG, Next/Image, Web Vitals |
| Testing | Jest + React Testing Library |
| Type safety | TypeScript + Zod |
This project is a modern, headless WooCommerce storefront built with Next.js. It uses React Server Components for product and shop pages, Server Actions for all cart and checkout mutations, and Zustand for state management (cart, checkout, wishlist). All WooCommerce API credentials and Stripe keys remain server-side for security.
Key technical highlights:
Stack: Next.js, React, Zustand, Zod, Stripe, Jest, Tailwind CSS, TypeScript, WooCommerce
Required WordPress plugins: WooCommerce
Variable products: Resolved at the Next.js layer, no theme customization needed
Testing: Jest + React Testing Library
Traditional WooCommerce stores serve every page from PHP — the database query, the HTML render, and the asset delivery all happen on the same server for every visitor. Under load, this creates bottlenecks, and performance degrades directly.
This architecture separates the concerns:
| Concern | Handled by | Benefit |
|---|---|---|
| Product & order data | WooCommerce / WordPress | Familiar admin, existing plugins, no data migration |
| Page delivery | Next.js on CDN edge | Pages served in milliseconds, globally |
| Checkout & payments | Stripe Checkout | PCI-compliant, trusted by customers, handles 3DS |
| Analytics | GTM + GA4 | Full funnel data, no third-party plugin needed |
next/image| Feature | Status |
|---|---|
| Product catalogue with filtering & sorting | ✅ |
| Full-text search | ✅ |
| Variable products (size, colour, etc.) | ✅ |
| Wishlist | ✅ |
| Slide-out cart drawer | ✅ |
| Multi-step checkout | ✅ |
| Live shipping rate calculation | ✅ |
| Stripe payment processing | ✅ |
| Cash on delivery / other WC payment methods | ✅ |
| Order confirmation page | ✅ |
| Dark / light mode | ✅ |
| Mobile-first responsive design | ✅ |
| Schema.org structured data (SEO) | ✅ |
The storefront is stateless — it holds no user data itself. You can run as many instances as needed behind a load balancer. WooCommerce handles inventory and order state. Stripe handles payment state. The frontend scales horizontally with zero configuration.
This storefront ships with a complete GA4 Enhanced Ecommerce implementation out of the box — most e-commerce sites miss half the funnel events or implement them incorrectly. This one does not.
| GA4 Event | When it fires |
|---|---|
view_item_list | Shop/category page loads |
select_item | User clicks a product card |
view_item | Product detail page loads |
add_to_cart | Item added to cart |
remove_from_cart | Item removed from cart |
add_to_wishlist | Item added to wishlist |
view_cart | Cart page / cart drawer opens |
begin_checkout | Checkout page loads |
add_shipping_info | Shipping method selected |
add_payment_info | Payment method selected |
purchase | Order confirmation page loads |
Every event includes the full ecommerce object: item IDs, names, categories, prices, quantities, currency, and the appropriate transaction/list context.
.env controls all tracking — no code changes needed to swap tags or add pixelsdataLayer is initialized in <head> before GTM loads, so zero events are lost during the GTM bootstrapEvery real user session reports LCP, CLS, INP, TTFB, and FCP as GTM events. This means you can segment Core Web Vitals by device, geography, or traffic source directly in GA4 or Looker Studio — no additional tooling needed.
Stripe checkout sessions carry the WooCommerce order ID in metadata, and the WooCommerce order confirmation page fires the GA4 purchase event with the correct revenue, tax, and shipping values — giving your attribution models accurate data.
git clone https://github.com/vakulkin/nextjs-woocommerce.git
cd nextjs-woocommerce
pnpm install
cp .env.example .env.local
Edit .env.local — see Environment Variables below.
pnpm dev
Open http://localhost:3000.
pnpm test
# WordPress / WooCommerce
NEXT_PUBLIC_SITE_URL=https://headless-woocommerce.adsister.com
NEXT_PUBLIC_WOOCOMMERCE_PROTCOL=https
NEXT_PUBLIC_WOOCOMMERCE_HOST=headless.adsister.com
WC_CONSUMER_KEY=ck_...
WC_CONSUMER_SECRET=cs_...
# Stripe
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
# Analytics
NEXT_PUBLIC_GTM_ID=GTM-XXXXXXX
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.