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.
Метод класса: WC_Emails{}
Хуки из метода
Возвращает
null. Ничего (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 Emails::customer details WC 10.4.2
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 ) );
}
}
}