For the complete documentation index, see llms.txt. This page is also available as Markdown.

Location

Match visitors based on their detected country, using a public IP-geolocation lookup.

Location matches a visitor based on their detected country. It's useful for restricting content by geography — for example, only showing a promotion to visitors in a specific country, or blocking a product page in a country you don't ship to.

Like most access rules (aside from the action-based ones such as Passcode, Secret link, Subscribe, and Confirmation prompt), Location can be set to match If the visitor's detected country is one of your selected countries, or Unless it is — inverting it to match every other country instead. See Combining rules.

Add the rule

  1. Open Locks and create a new lock, or open an existing one to edit it.

  2. Choose the content you want to protect. See Access rules overview for how rules fit into a lock.

  3. Click the Unlock rules tab, then in the Condition type dropdown, select Location.

The Unlock rules tab with Location selected in the Condition type dropdown.
Select Location from the Condition type dropdown on the Unlock rules tab.
  1. Search for and select one or more countries to match against.

The Location rule settings, showing a country picker with multiple countries selected.
Select the countries this rule should match against the visitor's detected country.
  1. Choose If or Unless.

  2. Click Save.

Shopper-facing copy

When a Location rule denies a visitor and the lock shows a message rather than redirecting, the default text is:

  • "This content is not available in your country."

This is editable per lock and per storefront language. See Translate lock messages.

Example: Make a product available only in the United States and Canada

Suppose a product can only be offered to visitors whose detected country is the United States or Canada.

  1. Select the product you want to protect.

The Lock setup tab with Specific products as the content type and one product listed under Restricted products.
Pick the product with the country restriction.
  1. Add Location, choose If, then pick United States and Canada from the Countries field. Each choice becomes a removable chip.

The Location condition with Rule logic set to If and United States and Canada added as chips under the Countries field.
The condition heading reads: If the visitor is from selected locations.
  1. Leave the rule's Redirect URL empty.

  2. Set the Location denied message to:

This product is only available to visitors in the United States and Canada.

This rule labels its message field Location denied message rather than Access denied message. The Preview panel shows this field's raw HTML instead of rendering it — that's a preview quirk only; the storefront renders the markup normally.

The Messages card showing the Location denied message field set to the United States and Canada availability wording.
For Location, the field is named Location denied message.
  1. Click Save.

Result on the storefront

A visitor detected in either selected country can view the product normally. A visitor detected anywhere else sees the locked content and the message above. The result is based on IP geolocation, not the customer's shipping address.

A location-restricted product page replaced entirely by the Content locked card carrying the United States and Canada availability message.
A visitor detected outside the selected countries sees the Location denied message from this example.

Because the lock covers a product, the app replaces the whole product page — the theme's header and footer included — rather than swapping the content inside your theme's layout. Page, collection, and blog locks keep the surrounding theme in place.

Last updated

Was this helpful?