Developer forum

Forum » Development » setting the currency and price of products, based on where the visitor comes from and/or redirecting trafik based on IP

setting the currency and price of products, based on where the visitor comes from and/or redirecting trafik based on IP

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

We are building an eCom solution, where the products have different prices in different countries/markets. What we want to achieve, is for visitors to land on the relevant pages, based on where they come from. So If you are visiting the page from Denmark, you land on one page with a specific set of prices and currency - and if you visiti the page from eg. Germany, you are directed to another website, with different prices and currency.

What is the best way to do this, and can it be done in standard Dynamicweb?

/Hans


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer

Hi Hans,

It can't be done standard, but it's not too hard to do custom either. You can subscribe to Dynamicweb.Notifications.Standard.Application.AuthenticateRequest. grab the user's IP address, convert that to a country code and then check the site the user is on. If the country code of the user doesn't match the one of the site, redirect the user, otherwise leave them on the site.

You'll need a few additional checks to bypass this logic (users in the backend, specific URLs for payment gateways, for example) and use a cookie to prevent the user from being redirected too often.

More info here: https://doc.dynamicweb.com/forum/cms-standard-features/cms-standard-features/use-geolocationservice-lookup-in-solution 

I can send you some sample code if you're interested. It's not fully  production-ready but it could be a start,..

Imar

Votes for this answer: 1
 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi Imar

thank you very mutch 👍🏻

yes, please send me the sample code  at hans(att)sendistovan.fo

/Hans

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Hans,

I sent you some code a while ago. Did you ever receive it?

Imar

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi Imar

sorry, i didn´t get back to you.

Yes I received it. Thank you very mutch 🙏

/Hans

 

 

You must be logged in to post in the forum