How to Block Specific Countries from Accessing Your Shopify Store Without App

Once launched, a Shopify store is available worldwide. But in many cases, it’s necessary to control your site access, especially when you want to stop scammers and hackers from particular countries. There are many best Shopify apps available to help you block visitors from specific countries. But if you want to do it manually then you can check out this article.

Please follow the steps below:

  • From your Shopify admin, go to Online Store > Themes.
  • Find the theme you want to edit, and then click Actions > Edit code.
  • Under Layout, select theme.liquid.
  • Putting the script below top of this file

  • Click Save and you are done.

I hope it’s helpful for you.

Happy coding!

You may also like...

6 Responses

  1. Tom says:

    this code blocked not only the countries we have chosen but all countries….

  2. Robert says:

    Hey there, I had a couple of the issues above, but I found out that the script only allows for one instance of a country or for some reason does not work. When I try to put a string of them together, it stops working. Also if I try to add separate if/else statements no go. I tried copying the entire scripts and making separate instances, still nothing. Right now I can only block one country with this script. Do you have any idea why this would be happening?

  3. Robert says:

    dude!! never mind I got the app. So easy and thank you so much for making it affordable!!! So much appreciation for keeping the online community helpful 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *