Theme Playground

Commerce

CountryRedirect

Dismissible banner suggesting a redirect to the visitor's detected country store. Persists dismissal in localStorage.

Best for

geo-targeted redirectscountry store switchinglocalized shopping experience

Import

import { CountryRedirect } from "@enadhq/enad-react-sdk/client/storefront"

When to use it

Use CountryRedirect when the storefront serves multiple country-specific stores and you want to suggest visitors switch to their local version. It detects a mismatch between the visitor's country and the current store, then shows a dismissible banner.

Composition notes

CountryRedirect is a self-contained banner:

  • detectedCountry and currentCountry are objects with code, name, and optional flag. The banner only shows if they differ.
  • redirectUrl is where the accept button navigates.
  • onAccept and onDismiss are optional callbacks for analytics or custom behavior.
  • persistKey controls the localStorage key for dismissal persistence. Set to false to disable persistence.
  • labels lets you customize the message, accept, and dismiss button text.

Behavior and theming guidance

The banner renders nothing if countries match or if the visitor previously dismissed it (checked via localStorage). On accept, it navigates to redirectUrl. On dismiss, it hides and persists the dismissal.

Keep the message short and the country names localized. The banner should feel helpful, not intrusive.

Examples

Live examples you can edit directly in the sandbox.

1 example

Country redirect banner

A banner that appears when the detected country differs from the current store. Dismissal is persisted so it only shows once.

Component Sets

Preview the first example across the available component-set presets to compare tone, spacing, and structural defaults.

Props

PropTypeDefaultDescription
detectedCountryCountryInfo
The country detected from the visitor's location
currentCountryCountryInfo
The country the store is currently serving
redirectUrlstring
URL to redirect to for the detected country's store
onAcceptstring
Called before navigating to the redirect URL
onDismissstring
Called when the visitor dismisses the banner
persistKeystring
localStorage key for persisting dismissal. Set to `false` to disable persistence.
labelsstring{}
No description yet.
classNamestring
No description yet.