Country Detection Modal
File:
snippets/country-detection-modal.liquidUsed in sections:
collection
Screenshot not yet added.
Save as
Save as
docs/src/assets/screenshots/snippet-country-detection-modal.pngDescription
Country Detection Modal & Filter Persistence
Two main features:
-
Country Detection Modal:
- Detects visitor’s country via IP geolocation
- Prompts non-US visitors to view programs in their country or worldwide
- Only shows if visitor’s country has active programs (count > 0)
- Uses metaobject GID for filtering
-
Filter Persistence:
- Saves ALL collection filters to sessionStorage
- Restores filters when navigating back to collection
- Shows banner when filters are active
- Allows clearing all filters at once
- Works with: Country, Location, Trainers, Program Type, Collection, Length, etc.
Features:
- Session-based persistence (clears on browser close)
- Detects filter changes from both modal and manual filter selections
- Smart banner shows filter summary (e.g., “Italy + 2 more filters”)
- One-click clear all filters button
Requirements:
- Country filter must be enabled in collection settings
- Must be rendered on a collection page with filters
Usage
{% render 'country-detection-modal' %}