I have searched many topics but I did not find the exact solution for my problem.
I need to create a dropdown which will be placed at whole website because you always can change your location to another city to see the offer. I would like to create a dropdown where customer selects his city for a local delivery. This dropdown will be placed at the intro page and at everypage with offer. After user selects the city then a cookie will be created and user will be redirected to page he selects. The city he selects should always remembered.
What is my problem? Let me explain.
Now when I select the city and for example its New York and my dropdown is located at New Yorks page aswel for city change I keep being redirected and it never ends. So I get infinity redirects.
Second thing which curently works. When you visit the main url adress for example –> example.com it should redirect you to your city if you have chosen your city before. So if you have selected New york before it should redirect you to example.com/kategoria-produktu/cadca/
To sum up: Everything works great but when this dropdown is located at the whole site I keep being redirected at the page I have selected and that is what I need to eliminate.
Any ideas please?
My code is here
Solved by editing code