Skip to content

Getting country from Geolocation IP #1323

Answered by juanpprieto
carstensbix asked this question in Help
Discussion options

You must be logged in to vote

@caha20 @carstensbix

If hosted in Oxygen, you can access the geo country and IP via the oxygen request headers. Here is a little utility that can help you extract these from a request

type OxygenEnv = {
  buyer: {
    readonly ip: string | undefined;
    readonly country: string | undefined;
    readonly continent: string | undefined;
    readonly city: string | undefined;
    readonly isEuCountry: boolean;
    readonly latitude: string | undefined;
    readonly longitude: string | undefined;
    readonly region: string | undefined;
    readonly regionCode: string | undefined;
    readonly timezone: string | undefined;
  };
  readonly shopId: string | undefined;
  readonly storefrontId: s…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@blittle
Comment options

@carstensbix
Comment options

Answer selected by blittle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants