Back to list of all filter and action hooks for Address Book for WooCommerce.
Description #
Customize which address fields are used in the account address edit pages, and their attributes.
Similarly to how woocommerce_billing_fields and woocommerce_shipping_fields work, allows to modify the fields configuration array used when displaying address editing forms, including labels, types, and other field properties.
Parameters #
$fields(array) Address fields array.field_key(array) Field configuration for each field.label(string) Field label text.type(string) Field type (text, select, etc.).required(bool) Whether field is required.class(array) CSS classes for the field.priority(int) Field display priority.options(array) Options for select fields.
Examples #
/**
* Change company field label to "Business name" in address book forms
*/
function change_company_field_label_to_business_name( $fields ) {
// Check if company field exists and modify its label
if ( isset( $fields['company'] ) ) {
$fields['company']['label'] = 'Business name';
}
return $fields;
}
add_filter( 'fc_pro_address_book_address_fields', 'change_company_field_label_to_business_name', 10 );
