WC_Emails::customer_details
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{}
Hooks from the method
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() 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 ) );
}
}
}