wc_get_account_formatted_address()
Get account formatted address.
Hooks from the function
Return
String
.
Usage
wc_get_account_formatted_address( $address_type, $customer_id );
- $address_type(string)
- Type of address; 'billing' or 'shipping'.
Default: 'billing' - $customer_id(int)
- Customer ID.
Changelog
Since 3.2.0 | Introduced. |
wc_get_account_formatted_address() wc get account formatted address code WC 9.6.0
function wc_get_account_formatted_address( $address_type = 'billing', $customer_id = 0 ) { $getter = "get_{$address_type}"; $address = array(); if ( 0 === $customer_id ) { $customer_id = get_current_user_id(); } $customer = new WC_Customer( $customer_id ); if ( is_callable( array( $customer, $getter ) ) ) { $address = $customer->$getter(); unset( $address['email'], $address['tel'] ); } return WC()->countries->get_formatted_address( apply_filters( 'woocommerce_my_account_my_address_formatted_address', $address, $customer->get_id(), $address_type ) ); }