DEV Community

Cover image for Stop Using Headless Chrome to Scrape Shopify & WooCommerce (Pure HTTP JSON Guide + Benchmarks)
StoreIntel Labs
StoreIntel Labs

Posted on

Stop Using Headless Chrome to Scrape Shopify & WooCommerce (Pure HTTP JSON Guide + Benchmarks)

Whenever someone needs to pull product catalogs, stock availability, or lead data from Shopify and WooCommerce stores, the default instinct is to spin up Playwright or Puppeteer.

I used to do the same—and it was a disaster for unit economics:

  • 2–4 GB of RAM per container just to render hero banners and tracking scripts you don't need.
  • Brittle CSS selectors that break every time a store switches themes.
  • Slow runs (5–15 seconds per page) and random Chromium timeouts on scheduled jobs.

In reality, both Shopify and WooCommerce expose clean, public, structured JSON endpoints out of the box. Switching from headless browsers to pure async HTTP dropped my compute cost to $0.02 per ~2,400 results with a 100% daily run success rate on scheduled production jobs.

Here is how it works under the hood, the exact edge cases you'll hit in production, and a clean Python snippet you can run right now.


1. The Public JSON Endpoints Both Platforms Expose

Shopify: /products.json

Almost every standard Shopify storefront exposes its full product catalog with variants, SKUs, prices, compare_at_price, tags, and boolean available flags at:

https://example-store.com/products.json?limit=250&page=1
Enter fullscreen mode Exit fullscreen mode

You paginate page=1, 2, 3... until the products array comes back empty. One HTTP request returns up to 250 full products with all their variants—something that would take 10+ rendered HTML pages in Playwright.

WooCommerce: /wp-json/wc/store/v1/products

Modern WooCommerce stores expose the public Store API v1 (no API keys required):

https://example-woo-store.com/wp-json/wc/store/v1/products?per_page=100&page=1
Enter fullscreen mode Exit fullscreen mode

It returns structured JSON with pricing, is_in_stock, categories, SKU, attributes, and images—completely independent of the WordPress theme.


2. Minimal Auto-Detecting Scraper in Python (httpx)

Here is a lightweight async script that auto-detects whether a domain is running Shopify or WooCommerce and pulls normalized products + stock status without launching a single browser process:

import asyncio
import httpx

HEADERS = {
    "User-Agent": "Mozilla/5.0 (compatible; StoreCatalogBot/1.0)",
    "Accept": "application/json",
}

async def fetch_shopify_products(client: httpx.AsyncClient, base_url: str, max_pages: int = 5):
    items = []
    for page in range(1, max_pages + 1):
        resp = await client.get(f"{base_url}/products.json", params={"limit": 250, "page": page})
        if resp.status_code != 200 or "application/json" not in resp.headers.get("content-type", ""):
            break
        products = resp.json().get("products", [])
        if not products:
            break
        for p in products:
            variants = p.get("variants", [])
            in_stock = any(v.get("available") for v in variants)
            items.append({
                "platform": "shopify",
                "title": p.get("title"),
                "handle": p.get("handle"),
                "price": variants[0].get("price") if variants else None,
                "in_stock": in_stock,
                "variant_count": len(variants),
            })
        if len(products) < 250:
            break
    return items

async def fetch_woo_products(client: httpx.AsyncClient, base_url: str, max_pages: int = 5):
    items = []
    for page in range(1, max_pages + 1):
        resp = await client.get(
            f"{base_url}/wp-json/wc/store/v1/products",
            params={"per_page": 100, "page": page},
        )
        if resp.status_code != 200:
            break
        products = resp.json()
        if not isinstance(products, list) or not products:
            break
        for p in products:
            prices = p.get("prices", {})
            minor = int(prices.get("currency_minor_unit", 2))
            raw_price = prices.get("price")
            price = int(raw_price) / (10 ** minor) if raw_price else None
            items.append({
                "platform": "woocommerce",
                "title": p.get("name"),
                "handle": p.get("slug"),
                "price": price,
                "in_stock": p.get("is_in_stock", False),
                "variant_count": len(p.get("variations", [])),
            })
        if len(products) < 100:
            break
    return items

async def scrape_store(domain: str):
    base_url = f"https://{domain.strip().rstrip('/')}"
    async with httpx.AsyncClient(headers=HEADERS, timeout=15.0, follow_redirects=True) as client:
        shopify = await fetch_shopify_products(client, base_url)
        if shopify:
            return shopify
        return await fetch_woo_products(client, base_url)

if __name__ == "__main__":
    results = asyncio.run(scrape_store("allbirds.com"))
    print(f"Extracted {len(results)} products")
    if results:
        print(results[0])
Enter fullscreen mode Exit fullscreen mode

Memory footprint? Under 60 MB. Runtime for a 500-product catalog? Usually under 1.5 seconds.


3. Going Beyond Products: Tech Stack & Contact Emails (Still Zero Chrome)

If you're building B2B lead enrichment or competitive intelligence pipelines (for n8n, Clay, or Make), you don't need a browser to detect apps or find store contacts either:

  1. One GET / on the homepage HTML lets you fingerprint 30+ pixels and apps via script URLs and meta signatures (klaviyo.com, connect.facebook.net, analytics.tiktok.com, judge.me, gorgias.chat, rechargepayments.com, etc.).
  2. One GET /policies/contact-information on Shopify (plus /pages/contact fallback) surfaces verified support/business emails (support@, hello@, wholesale@) far more reliably than scraping footers alone.

4. Production Edge Cases You Will Hit

Writing a 60-line script is easy; keeping it at 100% success across thousands of random stores takes handling a few annoying quirks:

  • WooCommerce minor-unit pricing: WooCommerce Store API returns "price": "2999" with "currency_minor_unit": 2 (or 0 for JPY/KRW). Always divide by 10 ** currency_minor_unit, never hardcode / 100.
  • Rate limits (429 Too Many Requests): Shopify throttles aggressive bursts from a single IP. Adding exponential backoff + honoring Retry-After eliminates 95% of failed runs.
  • Custom storefronts & disabled JSON: A small percentage of headless Shopify Plus stores disable /products.json or put Cloudflare in front of /wp-json/. You need graceful fallback logic so one blocked domain never crashes the whole batch.
  • Variant-level stock vs. product-level stock: A product can show up as "available" even when 4 out of 5 sizes are sold out. Always inspect the variants array if you're tracking real inventory health.

5. Real Production Numbers

Running this pure-HTTP architecture in production on Apify (including scheduled daily customer runs across live stores):

  • Compute cost: ~$0.02 for 2,431 extracted results
  • Daily scheduled run success rate: 100% (no Chromium OOM kills or selector drift)
  • Speed: 10–20x faster than Playwright-based e-commerce scrapers

Skip the Boilerplate (Hosted Actor + n8n / Clay Templates)

If you want to build it yourself, the Python code above is a solid starting point.

If you'd rather plug a maintained endpoint straight into n8n, Clay, Make.com, or Python—with built-in Shopify/WooCommerce auto-detection, retry handling, 30+ tech-stack/pixel detectors, verified store emails, and variant-level stock—I package and maintain this exact engine as a Pay-Per-Event Actor on Apify ($0.90 / 1,000 results, free tier included):

If you're scraping e-commerce stores in production, what's the trickiest edge case you've run into so far? Happy to swap notes in the comments.

Top comments (0)