Back to list of all filter and action hooks for Address Book for WooCommerce.
Description #
Modify an address entry before saving it from the account edit address pages.
Allows you to process or validate address data before saving it from the account area to the customer’s address book.
Parameters #
$address_entry(array) Address entry data.first_name(string) First name.last_name(string) Last name.address_1(string) Address line 1.address_2(string) Address line 2.city(string) City.state(string) State/Province.postcode(string) Postal code.country(string) Country code.company(string) Company name.phone(string) Phone number.email(string) Email address.
$user_id(int) User ID.
Examples #
/**
* Test function to modify address data before saving from account
*/
function modify_address_before_save( $address_entry, $user_id ) {
// Ensure city is always capitalized
if ( ! empty( $address_entry['city'] ) ) {
$address_entry['city'] = ucwords( strtolower( $address_entry['city'] ) );
}
return $address_entry;
}
add_filter( 'fc_pro_before_save_address_from_account', 'modify_address_before_save', 10, 2 );
