Back to list of all filter and action hooks for Address Book for WooCommerce.
Description #
Define which extra fields to save to a new address book entry when created from a new order at checkout.
This filter allows you to specify additional custom fields that should be included when automatically saving an address from a completed order to the customer’s address book.
Runs after the order has been created but before addresses are saved to the address book.
Parameters #
$extra_field_keys(array) Array of extra field keys to include. Default:array().$order_id(int) Order ID of the completed order.$data(array) Raw checkout form data from$_POST, containing all submitted field values including custom fields.
Examples #
/**
* Add custom fields to be saved to the address book when created from a new order at checkout.
*/
function add_custom_fields_when_creating_from_order( $extra_field_keys, $order_id, $data ) {
// Add custom fields to save to the address book entries
$extra_field_keys[] = 'vat_number';
$extra_field_keys[] = 'house_number';
return $extra_field_keys;
}
add_filter( 'fc_pro_address_book_save_from_order_extra_fields', 'add_custom_fields_when_creating_from_order', 10, 3 );
