> ## Documentation Index
> Fetch the complete documentation index at: https://nce-docs.bglobale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Replacing the Global-e Country Switcher

It is possible to replace the Global-e Country Switcher (also referred to as the "Shipping Switcher") with your own. This article explains the requirements and options available for doing so.

## GlobalE\_Data Cookie

Using your own Country Switcher requires that the `GlobalE_Data` cookie is set correctly.

<Note>
  The `GlobalE_Data` cookie is used to determine which country is currently selected and to change the currently selected country.
</Note>

### Structure

```
{
    "countryISO": "US",
    "currencyCode": "USD",
    "cultureCode": "en-US"
}

```

| Field                                                                                                             | Meaning                                                                                                                                                                                                                                                                                                                                                  | Examples                                                                               |
| ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `countryISO`                                                                                                      | The two-character [ISO 3166-1 Alpha-2 Country Code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) for the currently selected country                                                                                                                                                                               | United States: `US`<br />United Kingdom: `GB`<br />Germany: `DE`                       |
| `currencyCode`                                                                                                    | The three-character [ISO 4217 Currency Code](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) for the currently selected currency                                                                                                                                                                                                                    | US Dollar: `USD`<br />Pound Sterling: `GBP`<br />Euro: `EUR`                           |
| `cultureCode`(Optional) If you choose not to set the `cultureCode`, it is set automatically by Global-e scripts.) | A combination of:<br />The [ISO 639-1 two-letter lowercase culture code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) associated with a language<br />(optional) The [ISO 3166-1 two-letter uppercase subculture code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) associated with a country or region | English/United States: `en-US`<br />English/United Kingdom: `en-GB`<br />Germany: `de` |

### Reading the Cookie

The first time a shopper arrives at your site, the cookie may not be set (as Global-e has not yet identified them). This is the point at which you can use your own [GeoIP detection](/replacing-the-global-e-country-switcher#geo-ip--optional-) and set the GlobalE\_Data cookie yourself.

### Writing the Cookie

* If you choose to set the cookie on the **server side**, ensure that the value hasn't already been set (to avoid overriding changes the shopper has made).
* If you choose to set the cookie on the **client side**, make sure to refresh the page after setting the cookie (so that the Global-e scripts pick up the new value, serve the correct CSS file, and convert the prices correctly).

### Cookie Domain

When setting the cookie:

* Prefix the domain with a dot (to maintain compatibility with older browsers).
* Ensure the cookie is **not** `http` only.

See the following examples:

| Storefront URL                                                   | Cookie Domain           |
| ---------------------------------------------------------------- | ----------------------- |
| [https://example.com](https://example.com)                       | .example.com            |
| [https://store.myclothing.co.uk](https://store.myclothing.co.uk) | .store.myclothing.co.uk |

## User Localization External Methods

Instead of reading and setting the `GlobalE_Data` cookie directly, you can use our User Localization external methods.

For detailed specifications and usage of the `GetUserLocalization` and `SetUserLocalization` methods, please refer to the [External Methods](/external-methods) documentation applicable for PRO, NCE, and Enterprise hubs.

## Geo IP (optional)

You can choose to identify the shopper’s location via your own GeoIP logic.

**Important!** If you do so, ensure the following:

* The `GlobalE_Data` cookie is not already set.

  * If it is already set, do not identify the location of the customer and use the cookie value instead.
* You set the `GlobalE_Data` cookie from the server side in the initial page request. Otherwise, you risk conflicting with Global-e's GeoIP detection.

You can use our endpoint to geo-locate an IP address:

**Request (POST)**

```
{GeoIPDomain}/Browsing/LocationByIP?merchantGUID={MerchantGuid}&IP={IP_ADDRESS}&useIpv6=true
```

**Description**

Returns GeoIP information for the provided `{IP_ADDRESS}`.

**Notes**

In the above request:

* `{GeoIPDomain}` is one of the following two values, depending on the environment:

  | **Environment** | **GeoIPDomain**        |
  | --------------- | ---------------------- |
  | Production      | `api.global-e.com`     |
  | Sandbox         | `connect.bglobale.com` |
* `{IP_ADDRESS}` can be in either IPv4 or IPv6 format.
* If you don't know your Global-e `{MerchantGuid}`, contact your Global-e support representative.

**Example Response**

```
{
     "Country": {
         "Code": "IE",
         "Name": "Ireland (Republic of)",
         "DefaultCurrencyCode": "EUR",
         "DefaultCultureCode": "en-GB"
     },
     "Region": {
         "Code": "",
         "Name": "",
         "CountryCode": ""
     },
     "City": {
         "Code": "",
         "Name": ""
     },
     "IPRange": {
         "From": 281471592431616,
         "To": 281471592890367,
         "Type": "IPV4"
     }
}
```

## List of Countries

For a list of countries, you can use a static list of countries, or you can use the Global-e `GetCountries` API:

**Request**

```
{Domain}/externalapi/GetCountries?merchantToken={MerchantToken}
```

**Notes**

In the above request,`{Domain}` is one of the following values, depending on the environment:

| **Environment** | **Domain**             |
| --------------- | ---------------------- |
| Production      | `gepi.global-e.com`    |
| Sandbox         | `intgepi.bglobale.com` |

**Example Response**

```
{
    "countryCode": "US",
    "countryCodeISO3": "USA",
    "countryName": "United States",
    "isOperatedByGlobale": true,
    "defaultCurrencyCode": "USD",
    "isFixedPricesSupported": true
}
```
