WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Emails::order_meta() public WC 1.0

Add order meta to email templates.

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

Возвращает

null. Ничего.

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

$WC_Emails = new WC_Emails();
$WC_Emails->order_meta( $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::order_meta() WC 5.6.0

public function order_meta( $order, $sent_to_admin = false, $plain_text = false ) {
	$fields = apply_filters( 'woocommerce_email_order_meta_fields', array(), $sent_to_admin, $order );

	/**
	 * Deprecated woocommerce_email_order_meta_keys filter.
	 *
	 * @since 2.3.0
	 */
	$_fields = apply_filters( 'woocommerce_email_order_meta_keys', array(), $sent_to_admin );

	if ( $_fields ) {
		foreach ( $_fields as $key => $field ) {
			if ( is_numeric( $key ) ) {
				$key = $field;
			}

			$fields[ $key ] = array(
				'label' => wptexturize( $key ),
				'value' => wptexturize( get_post_meta( $order->get_id(), $field, true ) ),
			);
		}
	}

	if ( $fields ) {

		if ( $plain_text ) {

			foreach ( $fields as $field ) {
				if ( isset( $field['label'] ) && isset( $field['value'] ) && $field['value'] ) {
					echo $field['label'] . ': ' . $field['value'] . "\n"; // WPCS: XSS ok.
				}
			}
		} else {

			foreach ( $fields as $field ) {
				if ( isset( $field['label'] ) && isset( $field['value'] ) && $field['value'] ) {
					echo '<p><strong>' . $field['label'] . ':</strong> ' . $field['value'] . '</p>'; // WPCS: XSS ok.
				}
			}
		}
	}
}