Address autocomplete

คุณสามารถใช้ Google Places API บนเว็บไซต์ของคุณเพื่อให้แน่ใจว่าที่อยู่จัดส่งของผู้ใช้มีอยู่จริงและผู้ให้บริการสามารถเข้าใจได้ Google Places API ช่วยให้นักพัฒนาสามารถเข้าถึงข้อมูลโดยละเอียดเกี่ยวกับสถานที่ต่างๆ ได้โดยใช้คำขอ HTTP ระบบเติมคำอัตโนมัติจะคาดเดารายชื่อสถานที่เมื่อผู้ใช้เริ่มพิมพ์ที่อยู่

Address autocomplete example

To do so, go to Website ‣ Configuration ‣ Settings and enable Address Autocomplete in the SEO section.

Enable address autocomplete

Insert your Google Places API key in the API Key field. If you don't have one, create yours on the Google Cloud Console and follow these steps.

Step 1: Enable the Google Places API

Create a New Project: To enable the Google Places API, you first need to create a project. To do so, click Select a project in the top left corner, New Project, and follow the prompts to set up your project.

Enable the Google Places API: Go to the Enabled APIs & Services and click + ENABLE APIS AND SERVICES. Search for "Places API" and select it. Click on the "Enable" button.

Note

Google's pricing depends on the number of requests and their complexity.

Step 2: Create API Credentials

Go to APIs & Services --> Credentials.

Create credentials: To create your credentials, go to Credentials, click Create Credentials, and select API key.

Restrict the API Key (Optional)

For security purposes, you can restrict the usage of your API key. You can go to the API restrictions section to specify which APIs your key can access. For the Google Places API, you can restrict it to only allow requests from specific websites or apps.

Important

  • Save Your API Key: copy your API key and securely store it.

  • Do not share it publicly or expose it in client-side code.