Adding custom user meta data to WooCommerce email
-
I’ve added the code below into a WooCommerce e-mail template. It adds the last_name user meta data of the user into the e-mail. It works fine.
However, I have created a custom user meta data item called ‘title’ (i.e. for Mr, Mrs, etc.) which is captured at checkout. If I change
$key = 'last_name';
to$key = 'title';
this code doesn’t work anymore.Would appreciate any help ?? Jas.
<?php $user = get_user_by('login', $user_login ); ?> <?php $user_id = $user->ID; ?> <?php $key = 'last_name'; ?> <?php $single = true; ?> <p> <?php $meta_value = get_user_meta( $user_id, $key, $single ); ?> <?php _e('Value is '); ?><?php echo $meta_value; ?><br /> </p>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Adding custom user meta data to WooCommerce email’ is closed to new replies.