Title: Auto Fill User Data
Last modified: August 2, 2024

---

# Auto Fill User Data

 *  Resolved [yearsinbox](https://wordpress.org/support/users/yearsinbox/)
 * (@yearsinbox)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/auto-fill-user-data/)
 * Hey guys, loving your plugin. But, isn’t there any way to auto fill my clients
   detail via API endpoint or something like that? I’m coming from other plugin 
   that allowed me to do that. Cause i bring the user from a automation where i’ve
   already collected his basic data. Would be amazing call my Amelia appointment
   page pasting my client details as URL parameters (it is embedded in a iframe 
   on my automation tool), he would just need to choose his appointment data and
   by clicking “Next” to see all the fields pre populated. I’m really needing this,
   and not having will be a deal breaker for me 🙁

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [ameliabooking](https://wordpress.org/support/users/ameliabooking/)
 * (@ameliabooking)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/auto-fill-user-data/#post-17934083)
 * Hello,
 * Thank you for reaching out to us.
 * You can do it like this for example “?firstName=John&lastName=Doe&email=[john.doe@example.com](https://wordpress.org/support/topic/auto-fill-user-data/john.doe@example.com?output_format=md)“
 * you can add this JS hook on the page where booking form is:
   `<script>window.ameliaActions
   = {InitInfoStep: function (success = null, error = null, data) {//triggered once
   info step is shownconsole.log('InitInfoStep HOOK')console.log(data)const currentUrl
   = window.location.hrefconst url = new URL(currentUrl)const params = new URLSearchParams(
   url.search)data.booking.customer.firstName = params.get('firstName');data.booking.
   customer.lastName = params.get('lastName');data.booking.customer.email = params.
   get('email');}}</script>
 *  Thread Starter [yearsinbox](https://wordpress.org/support/users/yearsinbox/)
 * (@yearsinbox)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/auto-fill-user-data/#post-17937026)
 * Thank you soooooo much!
   I’ve improoved the code a litle bit for my needs, cause
   once this is pre filled, i didn’t wanna let the customer to edit this (would 
   mess my data base), soo, if someone ever need it, here it is:
 *     ```wp-block-code
       </script> window.ameliaActions = {    InitInfoStep: function (success = null, error = null, data) {        // Triggered once info step is shown        console.log('InitInfoStep HOOK');        console.log(data);                const currentUrl = window.location.href;        const url = new URL(currentUrl);        const params = new URLSearchParams(url.search);        const firstName = params.get('firstName');        const email = params.get('email');        const phone = params.get('phone');        if (firstName) {            data.booking.customer.firstName = firstName;            const firstNameInput = document.querySelector('input[name="firstName"]');            if (firstNameInput) {                firstNameInput.value = firstName;                firstNameInput.readOnly = true; //Block editing		firstNameInput.style.pointerEvents = 'none'; // Blocks all user interaction            }        }        if (email) {            data.booking.customer.email = email;            const emailInput = document.querySelector('input[name="email"]');            if (emailInput) {                emailInput.value = email;                emailInput.readOnly = true; //Block editing		emailInput.style.pointerEvents = 'none'; // Blocks all user interaction            }        }        if (phone) {            data.booking.customer.phone = phone;            setTimeout(() => {                const phoneInput = document.querySelector('input[name="phone"]');                if (phoneInput) {                    phoneInput.value = phone;                    phoneInput.readOnly = true; //Block editing            	    phoneInput.style.pointerEvents = 'none'; // Blocks all user interaction                }            }, 200); // It's needed to wait the complete field render, 200ms works fine!        }    }}</script>
       ```
   
 *  Plugin Author [ameliabooking](https://wordpress.org/support/users/ameliabooking/)
 * (@ameliabooking)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/auto-fill-user-data/#post-17938240)
 * Thank you very much for the update on this and for sharing the updated code.
 * We appreciate it!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Auto Fill User Data’ is closed to new replies.

 * ![](https://ps.w.org/ameliabooking/assets/icon-256x256.png?rev=3429091)
 * [Booking for Appointments and Events Calendar - Amelia](https://wordpress.org/plugins/ameliabooking/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ameliabooking/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ameliabooking/)
 * [Active Topics](https://wordpress.org/support/plugin/ameliabooking/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ameliabooking/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ameliabooking/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [ameliabooking](https://wordpress.org/support/users/ameliabooking/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/auto-fill-user-data/#post-17938240)
 * Status: resolved