Hi @sirrahikkala,
You can achieve it with this code snippet:
/**
* PDF Invoices & Packing Slips for WooCommerce:
* Display the customer role on the packing slip
*/
add_action( 'wpo_wcpdf_after_order_data', function($document_type, $order) {
if ( $document_type == 'packing-slip' ) {
// Only displays the field if it is not a guest order
if( $user = $order->get_user() ) {
global $wp_roles;
$customer_role = translate_user_role( $wp_roles->roles[$user->roles[0]]['name'] );
?>
<tr class="customer-role">
<th>Customer Role:</th>
<td><?php echo $customer_role; ?></td>
</tr>
<?php
}
}
}, 10, 2 );
If you haven’t worked with code snippets (actions/filters) or functions.php
before, read this guide: How to use filters