Joffre Ordinola Shopify Developer & E-commerce Specialist
|

Cloudflare Workers · Shopify Markets · GraphQL · Custom JS

A filter that disables unavailable variants by region before a shopper ever clicks the wrong one. No permission prompt, no app.

Regional Inventory Filter

Problem:

Stores selling in multiple markets needed to show shoppers only the variants actually available in their region. Shopify's native variant picker has no region awareness, and asking for browser location permission pushes most shoppers away.

Solution:

A Cloudflare Worker that detects the shopper's active market from the Shopify context, checks inventory by location, and disables size and color swatches independently. A sold out colorway does not imply the whole product is gone.

How it works:

The filter reads the active market from the Shopify context, with a URL parameter override and a country code fallback list for EU markets. It maps that market to specific Shopify location IDs and calls a Cloudflare Worker for per location stock data. Size and color availability are evaluated separately so a disabled option reflects that specific combination, not the whole product. A MutationObserver watches for product cards loaded by infinite scroll or quick buy panels and applies the filter to those too, without a page reload. Thirteen different fallback strategies handle variant ID detection across different theme setups, keeping the filter working regardless of future theme changes.

Tools:

  • Cloudflare Workers
  • Shopify Markets
  • GraphQL
  • Custom JS
  • MutationObserver

More projects

See all projects
B2B Wholesaler Hub

B2B Wholesaler Hub

Purpose built dealer portals with live pricing, bulk ordering, access control, and checkout rules. No wholesale app required.

Build Your Own Bundle

Build Your Own Bundle

A slot-based bundle builder that unlocks only when the right product count is met. No app required.