WC_Emails::customer_details()publicWC 1.0

Allows developers to add additional customer details to templates.

In versions prior to 3.2 this was used for notes, phone and email but this data has moved.

Method of the class: WC_Emails{}

Return

null. Nothing (null).

Usage

$WC_Emails = new WC_Emails();
$WC_Emails->customer_details( $order, $sent_to_admin, $plain_text );
$order(WC_Order) (required)
Order instance.
$sent_to_admin(true|false)
If should sent to admin.
Default: false
$plain_text(true|false)
If is plain text email.
Default: false

WC_Emails::customer_details() code WC 9.4.2

public function customer_details( $order, $sent_to_admin = false, $plain_text = false ) {
	if ( ! is_a( $order, 'WC_Order' ) ) {
		return;
	}

	$fields = array_filter( apply_filters( 'woocommerce_email_customer_details_fields', array(), $sent_to_admin, $order ), array( $this, 'customer_detail_field_is_valid' ) );

	if ( ! empty( $fields ) ) {
		if ( $plain_text ) {
			wc_get_template( 'emails/plain/email-customer-details.php', array( 'fields' => $fields ) );
		} else {
			wc_get_template( 'emails/email-customer-details.php', array( 'fields' => $fields ) );
		}
	}
}