1

这一切都有效 - 除了电子邮件通知打印丑陋的字段名称 - 不是标签

// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
 $fields['billing']['billing_extra_adult_member'] = array(
'label'     => __('2nd Adult Member', 'woocommerce'),
'placeholder'   => _x('Name', 'placeholder', 'woocommerce'),
'required'  => false,
'class'     => array('form-row-first'),
'clear'     => true
 );
 $fields['billing']['billing_extra_child_member1'] = array(
'label'     => __('1st Child Member', 'woocommerce'),
'placeholder'   => _x('Name', 'placeholder', 'woocommerce'),
'required'  => false,
'class'     => array('form-row-first'),
'clear'     => true
 );

return $fields;
}
/**
* Add the field to order
**/
function your_custom_field_function_name($order){
echo "<p><strong>Extra adult member:</strong> " .             
$order->order_custom_fields['_billing_extra_adult_member'][0] . "</p>";
}

add_action( 'woocommerce_admin_order_data_after_billing_address',    
'your_custom_field_function_name', 10, 1 );

/**
* Add the field to order emails
**/
add_filter('woocommerce_email_order_meta_keys',    
'my_custom_checkout_field_order_meta_keys');

function my_custom_checkout_field_order_meta_keys( $keys ) {
$keys[] = '_billing_extra_adult_member';
return $keys;
}

电子邮件通知包含:

_billing_extra_adult_member:乔·斯诺

我想做这个:

额外成人会员:乔雪

有人帮忙吗?

4

1 回答 1

-1
$keys['Extra adult member'] = '_billing_extra_adult_member';
于 2014-05-22T09:48:28.050 回答