add_filter( 'woocommerce_order_formatted_billing_address', 'custom_email_formatted_billing_address', 10, 2 );
function custom_email_formatted_billing_address( $billing_address, $order ){
// Get your custom field
$real_first_name = get_post_meta( $order->get_id(), '_billing_voornaam_1_24', true );
// Insert the custom field value in the billing first name
if( ! empty( $real_first_name ) )
$billing_address['first_name'] .= ' ' . $real_first_name;
// Hiding Last name
unset($billing_address['last_name']);
return $billing_address;
}
1 回答
根据this question / answer中的数据,可以使用以下钩子函数完成此操作,这将允许您编辑计费格式的地址数据:
代码位于活动子主题(或活动主题)的function.php文件中 .
经过测试和工作 .