CoCart API v2 · Headless WooCommerce · WordPress 7.0 · PHP 8.2

Headless WooCommerce. Instant.

Headless storefronts built on CoCart hit the product catalog API on every page render — product listings, single products, category navigation. That cost lands on every visitor, server-side, before a single byte reaches the client.

~38ms
Cache Hit Response
CoCart v2 · drop-in
~24×
Faster Than Uncached
drop-in vs full WP + WC + CoCart
~907ms
No Cache
median · WordPress + WooCommerce + CoCart

Every product endpoint. Every time.

Median response time across four CoCart v2 product endpoints — paginated listings with different sort orders, product categories, and a single product. CoCart’s rich response format (prices, images, variants, related products) makes payloads larger than standard WP REST API responses, but the drop-in still cuts response time by ~24×.

Median response time per endpoint (ms, lower is better)
FrostyCache HIT — drop-in
No cache (MISS)

Full timing breakdown.

50 requests per endpoint per mode. All times in milliseconds.

Endpoint Mode min avg median p95 max
/cocart/v2/products?per_page=10 MISS 949 999 997 1047 1074
HIT 37 39 38 48 50
/cocart/v2/products?per_page=5&orderby=popularity MISS 890 925 919 976 1002
HIT 37 39 38 49 55
/cocart/v2/products/categories MISS 817 856 847 911 1040
HIT 36 40 38 49 51
/cocart/v2/products/30 MISS 834 871 864 908 933
HIT 37 41 38 50 51

Catalog cached. Cart protected.

FrostyCache caches CoCart’s public product catalog endpoints and bypasses session-specific ones. Cart routes use a cart_key or CoCart-API-Cart-Key header to identify anonymous sessions — neither of these trip the standard auth checks, so FrostyCache’s CoCart module handles them explicitly.

Route Used for Cache
/cocart/v2/products Product listings — headless shop pages HIT
/cocart/v2/products/{id} Single product — headless PDP HIT
/cocart/v2/products/categories Category listings — headless navigation HIT
/cocart/v2/cart Cart — session-specific, identified by cart_key BYPASS
/cocart/v2/logout Session logout BYPASS
/cocart/v2/store Store settings — dynamic per-request BYPASS

WP REST Cache does not cache cocart/v2 endpoints by default — its allowlist only covers wp/v2. CoCart does not register itself with the plugin. Manual configuration through the WP REST Cache admin screen is required before any CoCart response is cached, and even then responses are stored as WordPress transients: WordPress still boots on every cache hit (~230ms).


Why ~38ms, not ~15ms?

The drop-in reads a JSON file and exits — its speed is bounded by file I/O, not by WordPress. CoCart v2 product payloads are 10–20× larger than a standard post response (prices, image variants, related products, add-to-cart metadata) so there is simply more data to read off disk and send over the wire. The ~23ms gap vs the WordPress core benchmark is the cost of that extra payload, not the caching layer. These numbers also use the full unfiltered response — headless storefronts using ?_fields=id,name,prices,images to request only the fields they render will produce smaller cache files and see HIT times closer to ~15ms.

📊 vs WooCommerce Store API

  • Both hit ~38ms HIT median on this machine
  • Store API payloads are leaner — fewer embedded arrays
  • CoCart v2 adds related/upsell arrays, add-to-cart metadata, per-currency formatting
  • MISS times also slightly higher for CoCart (~907ms vs ~860ms) — same reason
  • Same drop-in, same cache path, different payload size
  • Using ?_fields= to filter response fields shrinks the cache file further — HIT times approach ~15ms

⚡ What the drop-in still saves

  • ~869ms of WordPress + WooCommerce + CoCart bootstrap
  • No database connection on HIT
  • No plugin loading chain (~50+ hooks never fire)
  • No CoCart price calculation or image size lookup
  • Pure file I/O — read JSON, set headers, exit
  • ~24× faster despite the larger payload

How these numbers were measured.

🖥 Environment

  • Local by Flywheel
  • WordPress 7.0
  • PHP 8.2
  • WooCommerce 9.x
  • CoCart v2 (5.0.0-dev)
  • nginx · MySQL 8.4

⚗️ Test method

  • 50 requests per endpoint per mode
  • curl --time-total end-to-end
  • Cache warmed before HIT run
  • MISS uses skip_cache=1 to bypass cache

📐 Cache path

  • advanced-cache.php drop-in active
  • HIT exits before WordPress loads
  • No WooCommerce or CoCart bootstrap on HIT
  • MISS pays full WP + WC + CoCart boot cost

More benchmarks.

See how FrostyCache performs on standard WordPress REST API endpoints (~15ms / ~47×) and WooCommerce Store API FSE block endpoints (~38ms / ~23×).

WordPress Core Benchmark → WooCommerce Store API →

Ready to cache your
headless storefront?

Drop-in installation. Works on any WordPress host. Cart always stays fresh.