0

If want to develop a wordpress website like zomoto I want to know how to set user location detector on the website page so that user can get stores based on their selected place and after the store and food is selected it should show the delivery time of like with 45 min or 60 min from the restaurant to their place selected

1 Answers1

0

You can use getCurrentPosition() method to get the user's position. For example:

function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(userPosition);
    } else {
        alert("Geolocation is not supported by this browser.");
    }
}
function userPosition(position) {
    console.log(position) 
}

Or using if you want to use php please refer to Get user's current location in PHP

BlueSuiter
  • 527
  • 6
  • 21