Territories in Shopify geolocation rules: PR, HK, Jersey
By Beacon Wave Studio · · 7 min read
A store that ships to the United States, the United Kingdom and Denmark has, in its own mind, three countries. Shopify has rather more. Puerto Rico, Guam and the US Virgin Islands are not the United States; Jersey, Guernsey and the Isle of Man are not the United Kingdom; Greenland and the Faroe Islands are not Denmark. Each of them is a country of its own in Shopify Markets, in shipping zones, and in the country code that GeoBeacon detects for a visitor. This post lists the territories that most often surprise people, explains what GeoBeacon does with a visitor from one of them, and shows the two ways to make a rule cover them.
Where the country code comes from
GeoBeacon does not run its own IP database. It asks Shopify's own browsing context endpoint, the one Shopify uses to suggest a country and language to a shopper, and takes the two-letter code it returns. That code follows the same list Shopify uses everywhere else in the admin, which is the ISO 3166 list plus a few extras Shopify carries (Kosovo as XK, Ascension Island as AC, Tristan da Cunha as TA). The practical consequence is that a visitor in San Juan is detected as PR, not US, and a visitor in St Helier is JE, not GB. The country not detected post covers the case where no code comes back at all; this one is about codes that come back and do not match what you expected.
The territories that catch people out
Grouped by the country people assume they belong to. Every code in this list is a separate entry in Shopify's country list, and therefore a separate thing a rule has to name.
- United States. Puerto Rico (PR), Guam (GU), US Virgin Islands (VI), American Samoa (AS), Northern Mariana Islands (MP). Hawaii and Alaska are US. Military addresses are US.
- United Kingdom. Jersey (JE), Guernsey (GG), Isle of Man (IM), Gibraltar (GI), plus the overseas territories: Bermuda (BM), Cayman Islands (KY), British Virgin Islands (VG), Turks and Caicos (TC), Anguilla (AI), Montserrat (MS), Falkland Islands (FK), Saint Helena (SH). Northern Ireland, Scotland and Wales are GB.
- China. Hong Kong SAR (HK), Macao SAR (MO) and Taiwan (TW) are separate codes, separate currencies and, in Shopify Markets, separate countries to include.
- Denmark, Finland and Norway. Greenland (GL) and the Faroe Islands (FO) are not DK; the Åland Islands (AX) are not FI; Svalbard and Jan Mayen (SJ) are not NO.
- France. French Polynesia (PF), New Caledonia (NC), Saint Barthélemy (BL), Saint Martin (MF), Saint Pierre and Miquelon (PM), Wallis and Futuna (WF). Corsica is FR. The overseas departments that are legally inside the EU (Guadeloupe, Martinique, Réunion and others) are also separate codes, and the EU shorthand post explains how an EU rule treats them.
- Netherlands. Aruba (AW), Curaçao (CW), Sint Maarten (SX) and the Caribbean Netherlands (BQ).
- Australia and New Zealand. Norfolk Island (NF), Christmas Island (CX) and the Cocos Islands (CC) are not AU; the Cook Islands (CK), Niue (NU) and Tokelau (TK) are not NZ. Tasmania is AU.
- Spain, Portugal and Italy. The other way round: the Canary Islands, Ceuta and Melilla are ES, Madeira and the Azores are PT, Sicily and Sardinia are IT. They have special tax and customs status, but no code of their own, so a geolocation rule cannot tell them apart from the mainland.
What GeoBeacon does with a territory visitor
Suppose your rules say: visitors from US go to the US market, visitors from GB go to the UK market, and there is no third rule. A visitor from Puerto Rico is detected as PR. GeoBeacon walks the rules in order looking for one whose country list contains PR, finds none, and does nothing. The console shows the decision with the reason no-matching-rule, as described in the console log post. The visitor sees whatever market Shopify served them, which for a country not in any market is your primary market. Nothing broke; the rule simply never claimed PR.
Now suppose you add PR to the US rule, but Puerto Rico is not a country in your US market in Shopify Markets. The rule matches, the target is a market target for the United States, and the United States is a country you sell to, so the switch goes ahead: the visitor is moved to the US market and sees US prices. That is usually what a US store wants for Puerto Rico. Whether you can then ship there is a question for your shipping zones, where Puerto Rico is also listed separately; Shopify's Markets help describes how countries are added to a market.
The third case is a rule whose target is the visitor's own detected country, which the detected country target post covers. For a visitor from Hong Kong that means: switch to the Hong Kong market. If Hong Kong is not a country in any of your markets, GeoBeacon stops with country-not-offered and the visitor stays put. A market target can only switch to a country Shopify sells to; it will not invent a market.
Two ways to cover a territory
Name it in the rule. A rule's country list holds up to 250 codes, so there is room to add PR, GU, VI, AS and MP to the United States rule and JE, GG and IM to the United Kingdom rule. The rule then treats them exactly like the parent country. Do this when the territory should get the same store, prices and messaging as the parent, which is the common case for Puerto Rico and a US store.
Give it a rule of its own. When the territory should go somewhere different, add a rule for it above the parent rule. Hong Kong is the usual example: a separate market with its own currency, or a separate store altogether, in which case the target is a URL rather than a market and the external URL post applies. Jersey and Guernsey are another: outside UK VAT, often outside the UK shipping zone, so some stores prefer a popup that explains the situation to a silent switch into a market that will later refuse the address at checkout. Order matters because the first rule that lists the detected code wins; a dedicated HK rule below a rule that already lists HK will never run.
The regions you cannot target
Because detection returns a country code and nothing finer, the Canary Islands, Northern Ireland, Hawaii or Corsica cannot be given their own rule. If visitors from the Canary Islands need different treatment, it has to come from Shopify's side: a shipping zone that prices the islands differently, a tax override, or a note on the shipping policy page. For the one case where Shopify does go below country level, US states and Canadian provinces as submarkets, the submarkets post explains what a rule can and cannot do.
A ten-minute check
- Open Shopify Markets and, for each market, note which territories are included. Shopify lists them separately in the country picker, so a US market built by ticking United States alone does not contain Puerto Rico.
- Open your GeoBeacon rules and compare. Any territory you ship to should appear in a rule, either in the parent country's list or in its own.
- Test a few with the forced country parameter from the testing without a VPN post: try PR, HK and JE and read the reason in the console.
- For territories you do not ship to, decide whether silence is right or whether a popup should say so; the countries you do not ship to post weighs the options.
None of this is unique to GeoBeacon. Any geolocation tool built on country codes draws the same borders, because the codes do. The difference is whether the tool tells you when a visitor fell through, and GeoBeacon's console reasons exist so that a Puerto Rican visitor who saw nothing is a line you can read rather than a mystery.
Frequently asked questions
Does a United States rule in GeoBeacon cover Puerto Rico?
No. Shopify lists Puerto Rico as its own country with the code PR, and GeoBeacon's detection returns PR for a visitor there, so a rule whose country list says US does not match. Add PR to the same rule, or add a catch-all rule, if visitors from Puerto Rico should get the US store.
Why does GeoBeacon log country-not-offered for a visitor from Hong Kong?
Because the rule points at a market target and Hong Kong is not a country in any of your markets. A market target needs the destination country to be sold to in Shopify Markets. Either add Hong Kong to a market, or change the rule to a URL target that sends those visitors to a page that explains your options.
Are the Canary Islands or Northern Ireland separate countries for geolocation?
No. Shopify treats the Canary Islands as part of Spain (ES) and Northern Ireland as part of the United Kingdom (GB), so a rule for ES or GB catches visitors there. Regions that matter for tax or shipping but are not separate countries have to be handled in your shipping and tax settings, not in geolocation rules.
How do I find out which code a visitor was detected as?
Open your storefront with the browser console open and GeoBeacon prints the detected country code along with the decision it took and the reason, such as no-matching-rule or country-not-offered. The forced country test parameter lets you try a territory code without travelling there.