Add User Groups to New Order Email for Admin
-
Hello, I’m looking to list the ‘User Groups’ the customers are assigned to, into the WooCommerce New Order emails sent to Admins.
I have already added custom data (into the functions.php file), to display username & ID into these emails, using this code:
/**
- @snippet Add customer username and ID to WooCommerce emails
*/
add_filter( ‘woocommerce_email_customer_details_fields’, ‘add_user_id_to_woocommerce_emails’, 10, 3);
function add_user_id_to_woocommerce_emails( $fields, $sent_to_admin, $order ) {
$user_id = $order->get_customer_id();
$user_info = get_userdata( $user_id );$fields[‘user_id’] = array(
‘label’ => __( ‘User ID’, ‘woocommerce’ ),
‘value’ => $user_id
);$fields[‘username’] = array(
‘label’ => __( ‘Username’, ‘woocommerce’ ),
‘value’ => $user_info->user_login
);return $fields;
}—
I found these links, but I can’t seem to get it working?
https://docs.itthinx.com/document/groups/shortcodes/groups_user_groups/
https://docs.itthinx.com/document/groups/api/examples/ - @snippet Add customer username and ID to WooCommerce emails
- You must be logged in to reply to this topic.