B2B, retail and nested Shopify Markets in GeoBeacon rules
By Beacon Wave Studio · · 7 min read
Shopify Markets used to be a short list of regions. It is now a tree. A store can have a market for Europe with Germany nested inside it, a B2B market that applies to a wholesale buyer's company location, a retail market tied to a POS location, and a store default that catches everything else. GeoBeacon has a button that reads those markets and writes geolocation rules from them, which saves a lot of typing on a store with thirty countries. It also means the button has to make decisions about markets that have nothing to do with where a visitor is standing. This post explains what it does with each type, and what to tidy afterwards.
The four kinds of market
Shopify's developer documentation on market types describes a market as a group of conditions. A region market lists countries. A company location market (B2B) lists wholesale company locations. A retail location market lists POS locations. A market can combine conditions, and a store always has one default market that applies when nothing more specific does.
Only the first kind is about geography. A B2B buyer in Hamburg and a consumer in Hamburg are in the same place, but Shopify shows them different markets: the company location market for the buyer once they log in, the Germany (or Europe) market for the consumer. Location is not what separates them; account type is.
How Shopify picks a market when several match
A single buyer can qualify for more than one market, and Shopify resolves it by specificity. The market inheritance page gives the order: a company location beats a retail location, which beats a region, which beats the store default. Within regions, a market whose countries are a subset of another market's is treated as its child, and the child wins for its countries. Germany nested inside Europe means German visitors get Germany's settings and inherit from Europe anything Germany does not override.
This matters for geolocation because GeoBeacon does not choose the market. It chooses the country. When a visitor accepts the popup, the storefront's localization is switched to that country, and Shopify then applies whichever market is most specific for it. The app can say Germany; it cannot say Europe-but-not-Germany, and it does not need to.
What Generate from markets actually reads
The button appears on the rules page when you have no rules yet and at least one active market, and it is also in the page menu later. It asks the Admin API for your markets with their status, their region condition, and their web presence (the domain or subfolder, the locales, the root URL). For each market it builds the list of countries in the region condition. A market with no countries, which is what a pure company location or retail location market looks like, is left out entirely, because there is nothing to detect against.
Then it creates one rule per active market that still has countries left to claim. Each rule targets the market, matches the market's countries, uses the visitor's detected country as the destination country, and is labelled with the market name. Countries already covered by a rule you had before are skipped, so running the generator twice does not duplicate anything, and a rule you edited by hand is not touched.
Where it needs your judgement
A B2B or retail market that also names a country
Shopify lets a market combine conditions. A wholesale market can say "these company locations, in Canada", and then its region condition contains Canada. The generator sees a market with one country and makes a Canada rule pointing at the wholesale market. A consumer in Toronto who accepts the popup lands on the online store, where the wholesale market does not apply to them, so they get the consumer market for Canada anyway. The redirect is harmless but the rule label is misleading, and if you also have a consumer Canada market, Canada may already have been claimed by the wrong one.
Fix: after generating, read the labels. Any rule named after a wholesale or retail market should either be deleted or edited to target the consumer market for the same countries. The pause a rule post covers the toggle if you would rather keep it around while you think.
Parent and child regions
With Europe (27 countries) and Germany (1 country) both active, the first of the two the API returned claims Germany. If Europe came first, Germany is inside the Europe rule and the Germany market gets no rule of its own. The visitor outcome is still correct, because Shopify applies the Germany market once the country is Germany. What changes is the popup text, which names the destination the rule points at. If you want German visitors to read "switch to the Germany store" rather than "switch to the Europe store", edit the Europe rule to remove Germany and add a Germany rule. Rule order matters as well; the EU shorthand and rule order post explains why a specific rule should sit above a broad one.
Submarkets and states
A market scoped to a US state or a Canadian province has a region condition at the country level as far as the generator can see, so it produces a country rule, not a state rule. The submarkets post goes into what GeoBeacon can and cannot do below country level.
The store default
The default market usually has countries of its own (the home country, often more). The generator treats it like any other region market, which is right: visitors from those countries should be told they are already in the right place, and GeoBeacon's decision logic reports "already there" and stays quiet when the detected country is served by the current market.
A worked example
A kitchenware brand has five active markets: United Kingdom (default, GB), Europe (26 countries), Germany (DE, nested), Trade (company locations, with GB in its region condition), and Showroom (one retail location, no countries). Generate from markets produces four rules. Showroom is skipped. United Kingdom claims GB; Trade finds GB already claimed and ends up with no countries, so it is skipped too, which is the lucky case. Europe and Germany each get a rule; whether Germany is inside Europe's depends on the order the API returned them. The merchant reads the list, sees four labels, moves the Germany rule above Europe, and is done in under a minute.
Had Trade listed Canada instead of GB, a Canada rule pointing at the wholesale market would have appeared, and that is the one to delete.
Keeping the rules in step with Markets
Markets change: a country moves from Europe into its own market, a B2B market gains a region, a market is deactivated. GeoBeacon does not rewrite rules behind your back when that happens. Deactivated markets simply stop being valid destinations, and the generator only considers active ones the next time you run it. The new market checklist is the short routine for the common case of adding one market. For a larger reshuffle, deleting the market-type rules and generating again is quicker than editing each one, as long as you repeat the label check afterwards.
The underlying principle is simple enough to remember without the post: GeoBeacon detects countries, Shopify ranks markets. The generator is a shortcut from one to the other, and the only places it can mislead you are the places where a market's countries are not the reason the market exists.
Frequently asked questions
Does GeoBeacon redirect B2B customers to their company location market?
No. A B2B market is selected by Shopify when a logged-in company customer checks out, based on the company location, not on where the visitor is. GeoBeacon detects a country and offers the country's region market. The B2B market still applies at checkout for those customers, because Shopify ranks a company location above any region.
Why did Generate from markets create a rule for a market nobody can reach on the online store?
Because the generator keys off the countries a market lists in its region condition, not off its type. A B2B or retail market that also names a country produces a rule for that country, unless another rule already covers it. Delete that rule, or re-point it at the online store market, and keep the rest.
With a Europe market and a Germany market inside it, which rule do German visitors get?
Whichever market the generator met first claims Germany, and the rule label tells you which. If it chose Europe, edit the rule to target Germany instead. On the storefront Shopify applies the most specific market for the chosen country anyway, so prices and currency follow the Germany market either way; the rule only decides which destination the popup names.
Do I need to re-run Generate after adding a market?
Only if you want a rule created for the new market's countries. The generator skips countries that already have a rule, so running it again adds the missing ones and leaves your edited rules alone. Adding a rule by hand works just as well for a single new market.