Do not show certain products when the customer does not live/browse in the UK

Looking for custom code, to hide certain products when the customer does not live/browse from the UK (and to be easily added in the future to other products), viewed the following article but essentially need it in reverse? -

uniquely tagged do_not_sell_to_UK,

https://www.shopify.com/uk/partners/blog/customize-content-by-country#:~:text=To%20change%20content%20based%20on,with%20country%20selection%20built%20in

I know there are apps available, but they can affect SEO performance which we do not want to happen,

Hi @wcdes12 ,

You can create metafield for the same and get the user’s current country name using the script given below URL.

https://stackoverflow.com/questions/3489460/how-to-get-visitors-location-i-e-country-using-geolocation

The same can be achieved by the liquid code provided below

{{ localization.country.iso_code }}

You can add style=“display:none” attribute on products listing liquid files.

Like collection-product-grid and featured-product, there could be more liquid files.

Hope it will help

1 Like

Thank for the information, but unfortunately adding codes isn’t really what I know. Do you offer services to help setup?