Get formatted billing address for WooCommerce customer with PHP

/**
 * Gets formatted billing address for WooCommerce customer.
 *
 * @see https://wpcodebook.com/snippets/get-formatted-billing-address-for-woocommerce-customer-with-php/
 */
function wpcodebook_get_customer_billing_address( $customer ) {
	return WC()->countries->get_formatted_address( $customer->get_billing() );
}
  • to get the $customer object from customer/user ID:
$customer = new WC_Customer( $user_id );

Leave a Comment