谢谢,下次可以。我想出来了:
function my_custom_wc_api_order_response( $order_data, $order, $fields ) {
$customer_info = get_post_meta( $order->id, \'_customer_info\', true );
$order_data[\'payment_details\'][\'customer_info\'] = $customer_info;
// Apply filters if necessary
if ( $fields ) {
$order_data = WC()->api->WC_API_Customers->filter_response_fields( $order_data, $order, $fields );
}
return $order_data;
}
add_filter( \'woocommerce_api_order_response\', \'my_custom_wc_api_order_response\', 10, 3 );