Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/maikunari/geo-redirect-for-woocommerce/archive/refs/heads/main.zipRedirect or suggest switching visitors between .ca and .com WooCommerce stores based on their location.
Description
Geo-Redirect for WooCommerce sends visitors to the matching regional store when you run a Canadian (.ca) store and a US (.com) store with the same URL paths.
It uses WooCommerce geolocation, plus CDN country headers when they are present (Cloudflare, CloudFront, and common X-Country-Code / X-Geo-Country headers). US visitors on the .ca domain are sent toward the .com store; Canadian visitors on the .com domain are sent toward the .ca store. Other countries are left where they are. If location cannot be determined, nothing happens.
Modes
- Popup (default) — After a short delay, a suggestion appears so the visitor can switch stores or stay. This mode is intended to work with page caching.
- Redirect — Issues a 302 redirect to the same path on the other domain. Logged-in users, search-engine and social bots (user-agent match), admin/AJAX/cron/preview requests, and local development hosts are not redirected.
What the plugin actually does
- Remembers a manual store choice in a cookie (
wc_geo_store_choice) for 30 days - Adds a footer store switcher so visitors can change stores themselves (shown once both domains are configured)
- Preserves the current URL path when sending someone to the other domain (popup, redirect, and switcher)
- Lets you set the two domains, enable/disable the plugin, choose the mode, set popup delay, optional popup logo, and the US/CA popup messages
- Settings live under WooCommerce → Geo-Redirect
- Declares WooCommerce High-Performance Order Storage compatibility
Requirements
- WooCommerce 6.0 or higher, with Default customer location set to Geolocate or Geolocate (with page caching support)
- Matching URL paths on both stores (for example
/product/blue-widgetmust exist on both domains) - HTTPS on both domains
- Only two stores are supported: one Canadian domain and one US domain
Domains can be stored in settings or defined in wp-config.php as WC_GEO_CA_DOMAIN and WC_GEO_US_DOMAIN.
This plugin only handles location-based switching. Carts, accounts, and orders stay separate on each store.
Installation
- Upload the
geo-redirect-for-woocommercefolder to/wp-content/plugins/ - Activate the plugin through the Plugins screen in WordPress
- In WooCommerce → Settings → General, set Default customer location to Geolocate or Geolocate (with page caching support)
- Go to WooCommerce → Geo-Redirect
- Enter the Canadian domain and the US domain (host only, no
https://) - Choose Popup or Redirect mode and save
Frequently Asked Questions
Does this work with page caching?
Popup mode is designed for cached pages: location is checked with an AJAX request after the page loads. Redirect mode runs on template_redirect and may not work correctly with full-page caches.
Will this affect SEO?
Redirects use HTTP 302. User agents that look like search engines or common crawlers are skipped. The plugin does not add hreflang tags.
Can visitors stay on the store they chose?
Yes. The footer switcher and the popup both set a 30-day preference cookie. While that cookie is present, automatic suggestions and redirects stop.
What if my product URLs differ between stores?
The plugin copies the current path onto the other domain. If that path does not exist there, the visitor will land on a 404.
Does Cloudflare work?
Yes. If CF-IPCountry (or another supported CDN country header) is present, that value is used first. Otherwise the plugin uses the WooCommerce geolocation cookie or WC_Geolocation.
Can I add more than two countries?
No. Only Canada and the United States are supported.
Why are logged-in users not redirected?
Redirect mode skips logged-in users so staff and customers already signed in are not sent to the other domain mid-session. Popup mode can still appear for logged-in visitors.
Does this share carts or users between stores?
No.
Can I exclude individual pages?
Not in this version. Redirect mode skips admin, login, cron, REST, uploads, AJAX, previews, bots, logged-in users, and local hosts. Other front-end paths are eligible.
Screenshots
- Settings screen under WooCommerce → Geo-Redirect (domains, mode, popup options).
- Store suggestion popup shown when a visitor appears to be on the other region's store.
- Footer store switcher for a manual change.
Changelog
1.0.0
- Initial release
- Popup and automatic redirect modes for .ca / .com stores
- Country detection via CDN headers, WooCommerce geolocation cookie, and WC_Geolocation
- 30-day manual store-choice cookie
- Footer store switcher
- Bot exclusion and loop-prevention query flag
- Admin settings, optional popup logo, and custom popup messages
- WooCommerce HPOS compatibility declaration