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

Hura Product Showcase Builder

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.

You can use the tool here to generate code with custom texts and select block-specific countries.

I hope it’s helpful for you.

Happy coding!

Hura Theme Blocks

You may also like...

8 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 🙂

  4. stapzig says:

    Hey Kiet First of all, thank you for sharing, but I have a problem now, my jqHuraTipsScript.readyState shows that it is undefined, and the result is that all codes cannot work normally

Leave a Reply

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