Back to list of all filter and action hooks for Address Book for WooCommerce.
Description #
Modify the individual address entry before being added to the address book entries list.
Can be used to modify, validate, or process the specific address entry data. Triggered before the entry is added 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 #
/**
* Add "Company: " prefix to company field for better display
*/
function add_company_prefix( $address_entry, $user_id ) {
// Add "Company: " prefix if company field has a value
if ( ! empty( $address_entry['company'] ) ) {
$address_entry['company'] = 'Company: ' . $address_entry['company'];
}
return $address_entry;
}
add_filter( 'fc_pro_address_book_entry_before_add', 'add_company_prefix', 10, 2 );
