In this document:
Description
WordPress filter that enables access to the customer information defaults that Simply Schedule Appointments uses to auto-fill the booking form for logged-in users.
At the moment, only the Name and Email are auto-filled, but using this Filter allows you to add new custom variables to automatically auto-fill when a user is logged in.
Learn about the Auto-populate behavior for the Name and Email fields for WordPress users.
Placement
This code should be placed in the file of your custom plugin.
Source Code
This filter is located in the SSA_Customer_Information::get_defaults()
function in class-customer-information.php.
Usage for ssa/appointments/ customer_information/get_defaults Filter
add_filter(
'ssa/appointments/customer_information/get_defaults',
'new_function_name',
1,
1
);
Parameters
$defaults array
The variables of the customer information, this includes Name and Email as defaults.
Example – Customize Default Customer Information
add_filter(
'ssa/appointments/customer_information/get_defaults',
'ssa_customize_customer_information_defaults',
1,
1
);
function ssa_customize_customer_information_defaults( $defaults ) {
$defaults = array_merge( $defaults, array(
// automatically populate the Address field in SSA with data from the user's profile
'Address' => get_user_meta( get_current_user_id(), 'address', true )
) );
return $defaults;
}
Related Guides
-
Developer Settings
-
New Booking App
-
ssa/templates/get_template_vars Filter
-
ssa/forms/gravity/should_copy_field_to_ssa Filter