wc_get_account_formatted_address()
Get account formatted address.
Хуки из функции
Возвращает
Строку.
Использование
wc_get_account_formatted_address( $address_type, $customer_id );
- $address_type(строка)
- Type of address;
'billing'or'shipping'.
По умолчанию:'billing' - $customer_id(int)
- Customer ID.
Список изменений
| С версии 3.2.0 | Введена. |
Код wc_get_account_formatted_address() wc get account formatted address WC 10.8.1
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 ) );
}