# Cloudflare Workers for headless Shopify, close to every market.

> We put Cloudflare Workers in front of headless Shopify storefronts for routing, market detection, A/B tests, caching and media close to every shopper. Or we run the storefront on Workers outright, with Hydrogen, or Next.js through the OpenNext adapter. Shopify checkout stays native. It starts with a fixed-fee Readiness Assessment.

Headless commerce · Cloudflare at the edge

- **Starts with:** A fixed-fee Readiness Assessment
- **Typical build:** Phased: routing, caching, then tests, each priced first
- **You own:** The Workers, the rules and the documentation

## When does a headless storefront need Cloudflare?
- Shoppers in distant markets wait on a storefront served from one region.
- Market and language routing lives in browser scripts that flash or misfire.
- A/B tests run in the browser and shift the page as it loads.
- Product media is heavy, uncached or resized again on every request.
- You want the storefront itself on Workers, beside your other Cloudflare services.

## How do we build an edge layer?
1. **Map the traffic** — Markets, routes, cache rules and tests, from your analytics and logs.
2. **Design the edge** — What runs in Workers, what is cached, and what never is.
3. **Build in slices** — Routing first, then caching and media, then tests, each behind a switch.
4. **Measure** — Real-user performance and logs compared before and after each change.
5. **Hand over** — Every rule in code and documented, run by your team or ours.

## Edge logic in code, close to every market.
- Workers for routing, market detection and redirects
- Edge caching keyed by market, currency and language
- Cache purges tied to catalog changes in Shopify
- A/B tests assigned at the edge, without flicker
- Media resized and cached close to each market
- Where chosen, the storefront itself deployed on Workers
- Every rule in code, versioned and documented

## What usually goes wrong
- **Caching pages that hold personal data.** — Carts, accounts and checkout always bypass the cache.
- **Forcing shoppers into a market by location.** — We suggest a market; every market stays reachable.
- **Edge logic nobody can find later.** — Every rule lives in the repository, with tests.
- **Assuming every Next.js feature runs on Workers.** — The adapter is checked against what the build uses.

## Questions
### Can Cloudflare sit in front of our Shopify theme?

This work is for headless storefronts, where you control the hosting. A Liquid theme is hosted and cached by Shopify, so for a theme we improve speed inside the theme instead. The Readiness Assessment tells you which you need.

### Does the storefront have to run on Cloudflare?

No. Workers can sit in front of a headless storefront hosted elsewhere and handle routing, tests and caching. Or the storefront can run on Workers outright: Hydrogen, or Next.js through the OpenNext adapter. Your team and stack decide which.

### Will edge caching show shoppers stale prices?

It shouldn’t. Catalog pages and media are cached with keys that include market and currency, and purged when products change in Shopify. Carts, accounts and checkout are never cached, and checkout stays on Shopify.

### Does geolocation redirect shoppers automatically?

We suggest the right market rather than force it. The Worker reads the visitor’s country, the storefront asks Shopify for that market’s prices and language, and shoppers can still choose another. Crawlers can reach every market.

### How do A/B tests at the edge affect SEO?

Each shopper is assigned a variant at the edge and keeps it, so nobody sees one version flash into another. Variants point search engines to a single canonical page, and each test ends with the losing variant removed.

[Request a Readiness Assessment](https://www.studioantipodes.com/start-a-project)