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

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

wiredcampers
Tourist
12 0 1

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%...

 

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

Replies 2 (2)

gr_trading
Shopify Partner
1935 146 202

Hi @wiredcampers ,

 

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-geolocati...

 

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

For any custom development WhatsApp or connect at Email ID: gr.trading15@gmail.com for quick consultation. | Shopify Free codes
To support Buy Me a Coffee
wiredcampers
Tourist
12 0 1

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