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

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)
Frosty Cache 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.

Frosty Cache 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 Frosty Cache’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, confirmed live: requests to cocart/v2/products against a WP REST Cache install ran with no speedup at all across repeated requests. 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. Live-tested on its wp/v2 routes (the same underlying transient mechanism), that’s ~832ms median in production, vs Frosty Cache’s drop-in at ~751ms — see the full live comparison.


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 use the full unfiltered response. Headless storefronts using ?_fields=id,name,slug,permalink,prices,images,categories to request only the fields they render cut the payload from ~52KB to ~23KB — live-tested on the same production host, the filtered request now caches correctly and drops the HIT median from ~997ms to ~856ms, roughly a 14% improvement on top of the drop-in’s existing saving.

📊 vs WooCommerce Store API

  • Both hit ~38ms HIT median on a local development environment
  • 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= shrinks both the payload and the HIT time — live-tested at ~856ms vs ~997ms for the unfiltered response

⚡ 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 7.4
  • 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

Same story, on a real store.

20 requests per endpoint against a live CoCart v2 install on shared hosting. MISS baseline uses skip_cache=1 to bypass the drop-in. HIT is a normal request served by advanced-cache.php. Numbers include full network round-trip — real internet latency to a shared host, not a local loopback — which compresses the percentage gain but not the underlying savings: CoCart still skips WordPress, WooCommerce, and its own bootstrap entirely on a hit.

Median response time per endpoint — production (ms, lower is better)
Frosty Cache HIT — drop-in
No cache (MISS)
Endpoint Mode min avg median p95
/cocart/v2/products?per_page=10 MISS 1772 1853 1844 1988
HIT 844 989 996 1061
/cocart/v2/products?per_page=5&orderby=popularity MISS 1529 1594 1583 1688
HIT 832 892 874 1315
/cocart/v2/products/categories MISS 1294 1469 1431 2282
HIT 707 808 725 1715
/cocart/v2/products/{id} MISS 1259 1402 1357 1625
HIT 603 713 726 748

Median saving across the four endpoints: ~47% off TTFB — the largest live saving of the three benchmarked API surfaces on this host.


CoCart v2 vs WooCommerce Store API.

Same four product endpoints, same drop-in, same machine and same live host — the only variable is which API served the response. CoCart’s richer payload (related products, add-to-cart metadata, per-currency formatting) costs a few extra milliseconds on every mode, but the cache path itself is identical.

Endpoint Stack Local HIT Local MISS Live HIT Live MISS
products?per_page=10 CoCart v2 38 997 996 1844
WC Store API 38 903 990 1659
products?per_page=5&orderby=popularity CoCart v2 38 919 874 1583
WC Store API 38 897 878 1393
products/categories CoCart v2 38 847 725 1431
WC Store API 37 832 715 1195
products/{id} CoCart v2 38 864 726 1357
WC Store API 37 831 733 1214

All times in milliseconds, median. Local = Local by Flywheel loopback (no network overhead). Live = production run against a shared-hosting demo site (full network round-trip included).


More benchmarks

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

WordPress Core Benchmark → WooCommerce Store API → Frosty Cache vs WP REST Cache →

Ready to cache your
headless storefront?

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