Joffre Ordinola Shopify Developer & E-commerce Specialist
|

Cloudflare Workers · Cron Triggers · Workers KV · Search & Discovery

Store pickup sorted by distance and availability, directly in the collection filter. No browser permission prompt and no app.

Geo-Aware Store Pickup

Problem:

A 13 location retailer wanted shoppers to filter collections by pickup availability and see nearby stores sorted by distance on product pages. Shopify sorts pickup locations arbitrarily, native collection filters cannot read inventory by location, and browser geolocation asks for a permission most shoppers decline.

Solution:

A Cloudflare Worker that reads the shopper's location from the network request without asking the browser for anything, paired with a scheduled inventory sync that writes per product pickup availability into Shopify Metafields. That data becomes a real filter option in native Search & Discovery.

How it works:

The geo sort Worker reads the shopper's coordinates from the network request at the CDN level, calculates the distance to each pickup location, and geocodes any store missing coordinates using OpenStreetMap Nominatim with results stored permanently in Workers KV. Stores come back sorted by availability first, then by distance. No browser dialog, no delay. A second Worker runs on a schedule every hour, going through the full product catalog in batches of 100 via the GraphQL Admin API. It only updates the Metafield for products whose pickup status actually changed since the last pass, so API usage scales with real inventory changes and not with catalog size. A third endpoint handles store preselection in collection filter dropdowns using three fallback options in order: a URL parameter, a saved preference in localStorage, and a location lookup. It never applies the filter automatically.

Tools:

  • Cloudflare Workers
  • Workers KV
  • Cloudflare Cron Triggers
  • GraphQL Admin API
  • Shopify Search & Discovery
  • Metafields
  • OpenStreetMap Nominatim

More projects

See all projects
AI Search Optimization

AI Search Optimization

Sitewide structured data built in pure Liquid, zero apps, zero errors, so AI search engines and Google can read the store correctly.

Catalog Merge Migration

Catalog Merge Migration

A Python pipeline that groups hundreds of per color product pages into proper multi variant products, with 301 redirects for every archived URL.