Is there any way to detect visitors country in product page?

Highlighted
New Member
2 0 0

Hi all,

 

I would like to detect the country in which my visitors are on the product page so I could add some specific code for some countries. Searching on the documentation I have found the shop object (https://shopify.dev/docs/themes/liquid/reference/objects/shop) in which you can get the "shop.address.country" attribute but I guess that it is the country in which the shop has been created, not of the visitor.

 

I am thinking a similar approach that when on shipping stage of checkout and it automatically detects the country in which the visitor is and shows the tax according to his country but I cannot find this source code in any template.

 

I would like a solution in code or Shopify API, not external API's or apps. 

 

Is there any way to do that by code? Or use the similar approach that on shipping stage of checkout?

 

Thanks in advance!

0 Likes
New Member
2 0 0

Any idea of how to achieve this? It would be great that I could control that.

0 Likes