Block a country from accessing your website

Highlighted
New Member
2 0 0

Jason I decided to go with your recommendation here. Unfortunately for a noob like me it looks as though Im going to need help implementing this with my shopify store. I've added the script to my index page and registered my domain with their service in their trial but no joy. Maybe I could hire you to help?

 

OMG just chatted with their support, wow, talk about rude and unhelpful, maybe I just got someone having a bad day lol...

0 Likes
Highlighted
New Member
2 0 1

Shop Secure is the good choice for block a country from accessing your website.

 

This app is also create a GDPR consent banner to ask for visitors' consent before using their cookies and stay GDPR compliance.

And disable right-click and keyboard shortcut in your store. Protect your work from unfair competition.

 

 

 

0 Likes
Highlighted
New Member
1 0 0
# -------------------------------------------------------
# Source: https://ipfinder.io/
# -------------------------------------------------------
# _____ ______   __  _             _
#|_   _|| ___ \ / _|(_)           | |
#  | |  | |_/ /| |_  _  _ __    __| |  ___  _ __
#  | |  |  __/ |  _|| || '_ \  / _` | / _ \| '__|
# _| |_ | |    | |  | || | | || (_| ||  __/| |
# \___/ \_|    |_|  |_||_| |_| \__,_| \___||_|
#
#______  _                             _  _
#|  ___|(_)                           | || |
#| |_    _  _ __  ___ __      __ __ _ | || |
#|  _|  | || '__|/ _ \ \ /\ / // _` || || |
#| |    | || |  |  __/ \ V  V /| (_| || || |
#\_|    |_||_|   \___|  \_/\_/  \__,_||_||_|
# -------------------------------------------------------
# [Important] Please update this list every month
# February 24, 2019, 8:24 pm
# Total ips: 74,240
# Download by ASN: AS2
# -------------------------------------------------------
add address=103.219.213.0/24 comment="AS2" list=IPfinder
add address=103.78.244.0/24 comment="AS2" list=IPfinder
add address=103.78.245.0/24 comment="AS2" list=IPfinder
add address=103.78.246.0/24 comment="AS2" list=IPfinder
add address=103.78.247.0/24 comment="AS2" list=IPfinder
add address=103.91.160.0/22 comment="AS2" list=IPfinder
add address=128.4.0.0/16 comment="AS2" list=IPfinder
add address=168.194.156.0/23 comment="AS2" list=IPfinder
add address=168.194.158.0/23 comment="AS2" list=IPfinder
add address=168.195.232.0/24 comment="AS2" list=IPfinder
add address=168.195.233.0/24 comment="AS2" list=IPfinder
add address=45.6.180.0/24 comment="AS2" list=IPfinder
add address=45.6.182.0/24 comment="AS2" list=IPfinder

https://ipfinder.io/docs/#response-details

https://ipfinder.io/

0 Likes
Highlighted
New Member
2 0 0

unfortunately wont stop people who use known vpn's

0 Likes
Highlighted
Shopify Partner
1 0 0

Hi Partners, 

i want to block the entire European Union, as they Business Laws are not conductive and I do not want to sell over there. Found this post but it is a few years old. Maybe there are some new possibilities, so I ask again:

How can I realize this the easiest and cheapest way?

 

0 Likes
Highlighted
Excursionist
38 0 3

this page is not available , i guess 

0 Likes
Highlighted
New Member
2 0 0

To allow only customers from one country, for example the US, a simple solution would be using the free GeoIP service: 

https://freegeoip.app/

Create an empty .js file (custom.js), then link that file in the theme.liquid (  {{'custom.js' | asset_url | script_tag }}  ) and add the following code in it:

// IpGeolocation
    var httpRequest = new XMLHttpRequest();
  
    httpRequest.onreadystatechange = function() {
        if (4 === this.readyState && 200 === this.status) {
            var json = JSON.parse(this.responseText);
            redirect(json.country_code);
        }
    }
    httpRequest.open("GET", "https://freegeoip.app/json/", false);
    httpRequest.setRequestHeader("Accept", "application/json");
    httpRequest.send();

    function redirect(country_code) {
      if (country_code == "US" ) {
      return
      }else {
      window.location.href = "https://www.google.com/";
      }
    }
All others will be redirected to google.com.
Hope that will help!
0 Likes