Back to list of all filter and action hooks for Address Book for WooCommerce.
Description #
Modify the individual address entry before updating it in the address book entries list.
Can be used to modify, validate, or process the specific address entry data. Triggered before the entry is updated to the 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 #
/**
* Modify address entry before updating
*/
function modify_address_before_update( $address_entry, $user_id ) {
// Add 'Updated: ' prefix to company field
if ( ! empty( $address_entry['company'] ) ) {
$address_entry['company'] = 'Updated: ' . $address_entry['company'];
}
return $address_entry;
}
add_filter( 'fc_pro_address_book_entry_before_update', 'modify_address_before_update', 10, 2 );
