• Resolved cutu234

    (@cutu234)


    I would like to add the customer email to the invoice template. Would this be the correct way to do it?

    <?php echo $this->order->billing_email; ?>

    Thank you very much!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter cutu234

    (@cutu234)

    I’ve just tested it. It works.

    Hi!
    I was looking for this.
    I have tried the option you mention but in my case it has not worked.
    I have a similar code for the phone and it works, but for the email it doesn’t. I paste the text here. Can you help me?
    Thanks

    			<?php
    			printf( __('<br>Telefono: %s', 'woocommerce-pdf-invoices'), $order->get_billing_phone() );
    			?>
    			
    			<?php
    			printf( __('<br>Email: %s', 'woocommerce-pdf-invoices'), $order->get_billing_email() );
    			?>	
    			<?php
    			printf( __('<br>Email: %s', 'woocommerce-pdf-invoices'), $order->get_billing_email() );
    			?>	
    			<?php echo $this->order->billing_email; ?>
    Thread Starter cutu234

    (@cutu234)

    Which template did you modify? The $this variable is a reference to a specific object that is probably not available in your template. The printf function is not used in the invoice.php. Is your template outdated?

    Hi,
    I am using the free version and updated to the latest version.
    In the case of that code, the phone does display it correctly in the template, but in neither of the following two ways does it display the customer’s email.

    Thread Starter cutu234

    (@cutu234)

    The template ist not overwritten during an update (if located in your child theme folder). It might be that your template ist just very old or it is not the same template at all. Is it the invoice.php? If so, just compare it to the latest original file in the plugin folder.

    Hi, I’m using a template based on the SIMPLE/MINIMAL template and I just took the supposedly updated template and it’s the same. In the template information it appears that it is
    * @author Bas Elbers
    * @package WooCommerce_PDF_Invoices/Templates
    * @version 0.0.1
    */

    In this template PRINTF is used multiple times.

    Thread Starter cutu234

    (@cutu234)

    Oh, sorry, my mistake. I’ve just checked again and found out that I changed the plugin for this customer. So, here’s the code snippet I use on a site that actually uses this plugin. This is the whole block of the customer address. Template is body.php:

    <td class="address small-font" width="50%">
    			<b><?php _e( 'Rechnungsadresse', 'woocommerce-pdf-invoices' ); ?></b><br/>
    			<?php echo $this->order->get_formatted_billing_address(); ?><br/>
    			<?php echo $this->order->billing_email; ?><br/>
    			<?php if ( ! empty( $this->order->billing_phone ) ) :
    				printf( __( 'Tel.: %s', 'woocommerce-pdf-invoices' ), $this->order->billing_phone );
    			endif; ?>
    		</td>
    • This reply was modified 2 years, 12 months ago by cutu234.

    Thanks!
    This works for me.
    Have a nice day.

    Thread Starter cutu234

    (@cutu234)

    Glad to be of help.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Add customer email to invoice’ is closed to new replies.