Storeward Country Redirect for WooCommerce

Description

Some products cannot be sold everywhere. In one country you sell them yourself, in another an
Amazon listing or a local distributor takes over. This plugin sends visitors of a product page to
the right place instead of showing them a product they cannot order.

You add rules directly on the product: one country, one URL. Visitors from a country without a rule
see the product page exactly as before.

Example

  • Visitor from the United States: redirected to your Amazon US listing.
  • Visitor from Australia: redirected to your Australian distributor.
  • Visitor from Germany: sees your own product page. No rule, no redirect.

How it works

The country comes from the geolocation WooCommerce already includes, so there is no extra service,
no account, and no external API. The plugin adds a “Country redirect” tab to the product data box
and stores one list of rules per product. That is all it does.

Details that matter in practice

  • Search engine crawlers are never redirected, so your product stays indexed.
  • Logged-in shop managers are never redirected, so you can still open your own products. Add
    ?crwc_country=US to a product URL to see what a visitor from that country would get.
  • Redirects use HTTP 302, because the target depends on the visitor and must not be cached as a
    permanent move.
  • Product pages that have rules are excluded from full page caches. Pages without rules are not
    touched, so your cache hit rate stays where it is.
  • Rules that point back at the product itself are ignored, so a typo cannot create a redirect loop.
  • Only http:// and https:// URLs are accepted.
  • Uninstalling removes every value the plugin stored.

What it deliberately does not do

No analytics, no states or regions, no category or store-wide rules, no import/export, no licence
key, no telemetry, no external service.

Screenshots

Installation

  1. Install and activate the plugin. WooCommerce must be active.
  2. Go to WooCommerce › Settings › General and set “Default customer location” to “Geolocate” or “Geolocate (with page caching support)”. WooCommerce then downloads the MaxMind database it uses to detect countries. A free MaxMind licence key is entered on the same screen.
  3. Edit a product, open the “Country redirect” tab in the Product data box.
  4. Choose a country, enter the full target URL, and add more rules as needed.
  5. Update the product.

If geolocation is not returning a country, the plugin shows a notice in the admin area and no redirect happens.

FAQ

Do I need an account or an API key for this plugin?

No. The plugin uses the geolocation that ships with WooCommerce. WooCommerce itself needs a free
MaxMind licence key to download its country database; that is configured in WooCommerce, not here.

I use Cloudflare. Do I still need the MaxMind database?

No. WooCommerce also reads the country header that CDNs such as Cloudflare send, and this plugin
uses whatever WooCommerce resolves. If your CDN sends that header, geolocation works without the
MaxMind database.

Nothing is redirected. What is wrong?

Check three things. First, “Default customer location” in WooCommerce must be set to a geolocate
option and the MaxMind database must have been downloaded. Second, you are probably logged in as a
shop manager, and shop managers are never redirected. Third, the country you are testing needs a
rule on that specific product.

How do I test a rule without a VPN?

While logged in as a shop manager, add ?crwc_country=US to the product URL. The rule for that
country is applied to your own request. Visitors cannot use this parameter.

Does this break my page cache?

Only for product pages that actually have rules. Those pages set DONOTCACHEPAGE and send no-cache
headers, which the common caching plugins respect. Every other page, including products without
rules, stays cached as before.

Will this hurt my SEO?

Crawlers are excluded from the redirect, so search engines still see and index the product page.
The redirect itself is a 302, not a 301, so nothing is recorded as a permanent move.

Does it work with variable products?

Yes. Rules belong to the product, so they apply to the product page including all of its variations.

Can I redirect a whole category or the entire store?

No. Rules are set per product. That is intentional for this version.

How do I stop a redirect temporarily to look at the page?

Add ?crwc_no_redirect=1 to the product URL.

What happens when I delete the plugin?

All rules, the dismissed-notice flag and the cached geolocation check are removed from the database.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Storeward Country Redirect for WooCommerce” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.0.0

  • First release.