• Resolved mowlman

    (@mowlman)


    We use shopper Roles such as contractor1 or the default customer.
    We would like to include the customers Role on the Invoice or Receipt for their order. Any hints?

    Was thinking either edit print-content.php or add something to my functions file.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter mowlman

    (@mowlman)

    No reply from developer, fixed myself. at least, this works for me.

    Files involved:
    /wp-content/plugins/woocommerce-delivery-notes/templates/print-order/print-content.php
    /wp-content/plugins/woocommerce-delivery-notes/templates/print-order/style.css

    1st override print-content.php. Create folder for woocommerce within your child Theme, then create a subfolder called print-order and place print-content.php within this. This is now the file you want to edit.

    What worked for me I placed my code just beneath </div><!– .order-addresses –> which is around line 49 of print-content.php

    `<?php /* Add Shopper Role to Receipt START */ ?>
    <div class=”shopper-role”>
    <h3><?php
    $cust_user = get_post_meta( $order->id, ‘_customer_user’, true ); //get user for order
    $user_info = get_userdata($cust_user); //get user info for user
    echo ‘Shopper Role : ‘ . ucwords(implode(‘, ‘, $user_info->roles)) . “\n”; //get the roles for the user & make them titlecase with ucwords

    /* Add Shopper Role to Receipt END */ ?></h3> </div><!– .shopper-role –>`

    Then after overriding style.css I added the following to control font size

    .shopper-role {
         font-size: 1.25em; 
    }
    • This reply was modified 7 years, 4 months ago by mowlman.
    Plugin Author Vishal Kothari

    (@ashokrane)

    Hi @mowlman,

    Apologies for the delayed reply. I am glad you were able to fix this yourself & also thank you for posting your solution here. Overriding the 2 files & adding your changes is the correct way of doing this.

    :Vishal

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display Role on Invoice or Receipt’ is closed to new replies.