WC_Emails::customer_detailspublicWC 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{}

Returns

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 10.5.0

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

	/**
	 * Filter the customer details fields.
	 *
	 * @since 3.2.0
	 * @param array    $fields        Array of customer details fields.
	 * @param bool     $sent_to_admin If sent to admin.
	 * @param WC_Order $order         Order instance.
	 */
	$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 ) );
		}
	}
}