Hello everyone…
I’m creating a multi-country e-store using “wix stores” app. The reason is that I’ll be selling the same product at different prices (different prices for different countries).
Moreover, I want to have the ability to use one domain as the main access point to my e-stores. I want to be able to forward the users (based on the request IP address) to their relevant website.
For example,
- All customer will use the same domain name “www . myestore . com”
- Based on the country the request is originating from, I want to be able to forward users as follows:
- Requests from “country1” will be sent to “country1 . myestore . com”
- Requests from “country2” will be sent to “country2 . myestore . com”
- Requests from any other county will be sent to “default . myestore . com”
I managed to assign the sub-domains to different website at wix, however, I’m not sure how to handle the main incoming requests “www . myestore . com” and forward them based on the requester IP address.
Any idea how to do that?
You might be able to handle the country redirect using Routers .
Another way might be by using wix-location.to() .
For determining the site visitor’s country (based on IP), see Ahmad’s geolocation tutorial .
Thank you for the answer, Yisrael…
I managed to implement the IP identification and forwarding using the following:
- Create a landing page to receive all the requests to my domain www . myestore . com
- At this page, I introduced a js code to do the following:
- Fetch the source IP via exreme-ip-lookup website.
- Check the source country based on the IP
- use the " wixLocation . to" to redirect the users to the correct website.
The only issue is that, the landing page need to be fully loaded first, then the request will be redirected to the correct website.
I guess you are right, Wix Routers might be a better option, I tried to look into the Wix Router function, but unfortunately, the explanation is very high level and doesn’t help much.
Do you know of any good source explaining the Wix Routers?
Appreciate your help
The only source material on Wix Routers is the documentation I linked to , and wix-router API .
You can see an example of routers in use in the Stripe payment processing example .
@yisrael-wix Thanks Yisrael…
I’m trying to learn more about the routing functions…