Showing content to specific country

Showing content to specific country

Cmeer
Visitor
3 0 0

Hello,

 

I tried to use a custom liquid block to only show content to people from the Netherlands like this:

 

{% if localization.country.iso_code == 'NL' %}
SOMETHING TO SHOW
{% endif %}

 

 

Most of the time this seems to work. But not allways.

I noticed some of my Belgian visitors allso see the content sometimes.

 

Is there another variable i can check that is more reliable? Or another solution.

 

Thank you,

Collin

Replies 5 (5)

Vinsinfo
Shopify Partner
426 143 142

@Cmeer Please use below code instead of the code you shared to display something only for "Netherlands" customers. Kindly let me know whether it works.

 

{% if localization.country.name == 'Netherlands' %}
  SOMETHING TO SHOW
{% endif %}

 

 
Please provide your support by click "Like" and "Accepted" if our solution works for you. Thanks for your support.
Please reach out to [email protected] for any enquires related to Shopify.
Our Services: Custom Theme Development, Theme Customization, Custom Feature Implementation, Data Migration, Custom APP Development, Website Optimization and Google Merchant Center Support
Cmeer
Visitor
3 0 0

Thank you very much!

I had to use 'Nederland' instead of 'Netherlands'. I am testing it right now. Untill now it looks good. I will let you know tomorrow.

I am checking if it works by using hotjar to see recordings of people using the website. 

 

 

Vinsinfo
Shopify Partner
426 143 142

@Cmeer Happy to hear that my solution worked for you. Let me know for any future needs.

 
Please provide your support by click "Like" and "Accepted" if our solution works for you. Thanks for your support.
Please reach out to [email protected] for any enquires related to Shopify.
Our Services: Custom Theme Development, Theme Customization, Custom Feature Implementation, Data Migration, Custom APP Development, Website Optimization and Google Merchant Center Support
Cmeer
Visitor
3 0 0

Unfortunately i still see some Belgian visitors who see the content. I there another variable?:)

Vinsinfo
Shopify Partner
426 143 142

@Cmeer It might be because if visitors from Belgium select the Netherlands through the localization option or country selector popup while visiting your website. On that time, the content added for the Netherlands will be displayed, even when the user is located in the Belgium.

 
If you didn't provide localization select option, but the content is still displaying, please share your store URL to check your store further.
Please reach out to [email protected] for any enquires related to Shopify.
Our Services: Custom Theme Development, Theme Customization, Custom Feature Implementation, Data Migration, Custom APP Development, Website Optimization and Google Merchant Center Support