Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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
@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 %}
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.
@Cmeer Happy to hear that my solution worked for you. Let me know for any future needs.
Unfortunately i still see some Belgian visitors who see the content. I there another variable?:)
@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.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024