How to user "Shopify.country" to do url redirect?

Noticed in the header there are “Shopify.country” defined as var. I would like to do an URL redirect base on the country

It’s not working because of “Shopify.country” variable is not being called correctly

if Shopify.country == "US"; { window.location = "[www.mit.edu](http://www.mit.edu)"; else window.location = "[www.boston.edu](http://www.boston.edu)"; }

Try


Hey @radiofranky

Can you check if this is due to your syntax maybe.

Try this instead

if (Shopify.country === “US”) {

window.location = “www.mit.edu”;

} else {

window.location = “www.boston.edu”;

}

Thanks

Yash Garg

Thanks. It works. However, if your URL is at “www.mit.edu” and this will return “this site can’t be reached”. Your help is appreciated.

tks

This site can’t be reached

Check if there is a typo in www.poibo.net.

  • If spelling is correct, try running Windows Network Diagnostics.

DNS_PROBE_FINISHED_NXDOMAIN