This is an accepted solution.
Anders from the Shopify Social Care team here. Thanks for reaching out today.
If you're looking to have a bit more control over the traffic that's able to navigate to your site, the quickest way to get this done would be through the use of a third-party app found in our App Store. Specifically, I personally suggest looking into either Traffic Guard or Easy Location. Is there a particular reason why you're looking to block certain countries from accessing your site?
Ah, that's more than fair. And sounds like a plan, Elena. Let me know if there's anything further you need and best of luck with your business!
I see you have solved the problem. But there is one more suggestion for future consideration.
You may potentially use Geo Targetly. With its Geo Block tool, you can auto block visitors by country, state and city based on their locations. It can easily access visitors' locations based on IPs. You can easily set up to block visitors from a particular page or your entire website. No code is needed.
Hope it helps!