• Resolved petebm

    (@petebm)


    Hi
    Thanks for the plugin; is it possible, for someone with no coding experience, to add user_id to the invoice / packing list template?

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor kluver

    (@kluver)

    Hi @petebm,

    It might be challenging if you have no coding experience, but the easiest way is with a filter. Please read our documentation: Displaying customer numbers

    If you have never worked with code snippets or functions.php please read this too: Using filters

    If this is all over your head I would recommend upgrading to the Pro version. It’s way easier to implement user ids there. And you also get our premium support so we can help you out.

    I hope this helps.

    Have a great day!

    With kind regards,

    Michael

    Thread Starter petebm

    (@petebm)

    Hi Michael

    Thank you very much for your reply. With some trepidation I followed your links (the second link to Code Snippets on your ‘How to use filters’ page seems to be broken, btw), copied the code into a new snippet, activated it – and lo & behold, much to my surprise, the customer number appeared on your invoice.
    The only problem is . . . I misled you when I said it was the it was the user_id that I needed; it is in fact user_login, which is what we’re using as the unique identifier for our members. I tried just editing the snippet to read that, but of course that was expecting too much, & the invoice failed.
    Could I trouble you to suggest how I could get that?

    Thanks again
    Pete

    • This reply was modified 7 years, 1 month ago by petebm.
    Plugin Contributor Ewout

    (@pomegranate)

    Hi Pete,
    You would have to load the WordPress user data, here’s an example:

    
    add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_customer_username', 10, 2 );
    function wpo_wcpdf_customer_username ($template_type, $order) {
        if ($user_id = $order->get_user_id()) {
            $user_info = get_userdata($user_id);
            ?>
            <tr class="customer-number">
                <th>Username:</th>
                <td><?php echo $user_info->user_login; ?></td>
            </tr>
            <?php
        }
    }
    

    Hope that helps!
    Ewout

    Thread Starter petebm

    (@petebm)

    Hi Ewout

    Helps? It’s perfect! Thank you very much again, for the plugin & for your help to a newbie.

    All the best
    Pete

    Plugin Contributor Ewout

    (@pomegranate)

    Fantastic, glad to here that Pete! if you can spare a minute, I’d appreciate a review ??
    https://www.ads-software.com/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/#new-post

    Thanks!
    Ewout

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Showing user_id on invoice / packing list’ is closed to new replies.