Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    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

    Thread Starter sirrahikkala

    (@sirrahikkala)

    Thank you!

    Plugin Contributor Yordan Soares

    (@yordansoares)

    We are happy to help, @sirrahikkala!

    If you don’t mind and have the time, do you think you could leave us a review?

    Thanks in advance and all the best with your store!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Customer role to packing list?’ is closed to new replies.