WordPress filter hook
woocommerce_my_account_my_address_formatted_address
Defined by WooCommerce and fired by 3 plugins in total, running on 7M+ sites between them.
“Filter the billing address before formatting.”
How to use woocommerce_my_account_my_address_formatted_address
It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'woocommerce_my_account_my_address_formatted_address', function( $address, $arg2, $address_type ) {
// Change $address here.
return $address;
}, 10, 3 );Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
3 plugins that fire woocommerce_my_account_my_address_formatted_address
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WooCommerce7+ million installs
apply_filters( 'woocommerce_my_account_my_address_formatted_address', $address, $customer->get_id(), $address_type )includes/wc-account-functions.php:394 -
NP Quote Request for WooCommerce8,000+ installs
apply_filters( 'woocommerce_my_account_my_address_formatted_address', array( 'first_name' => get_user_meta($customer_id, $name_billing . '_first_name', true), 'last_name' => get_user_meta($customer_id, $name_billing . '_last_name', true), 'phone' => get_user_meta($customer_id, $name_billing . '_phone', true), 'company' => get_user_meta($customer_id, $name_billing . '_company', true), 'address_1' => get_user_meta($customer_id, $name_billing . '_address_1', true), ... )includes/classes/gpls_woo_rfq_functions.php:1581 -
Address Book for WooCommerce3,000+ installs
apply_filters( 'woocommerce_my_account_my_address_formatted_address', $woo_address_book_fields, $woo_address_book_customer->get_id(), $woo_address_book_key )templates/myaccount/my-address-book.php:108
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.