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.

Метод класса: WC_Emails{}

Хуки из метода

Возвращает

null. Ничего.

Использование

$WC_Emails = new WC_Emails();
$WC_Emails->customer_details( $order, $sent_to_admin, $plain_text );
$order(WC_Order) (обязательный)
Order instance.
$sent_to_admin(true|false)
If should sent to admin.
По умолчанию: false
$plain_text(true|false)
If is plain text email.
По умолчанию: false

Код WC_Emails::customer_details() WC 7.3.0

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 ) );
		}
	}
}