PrestaShop add customer email to invoice

PrestaShop PDF invoice won’t show customer email address by default for some strange reason. To show the email address in the Invoice, we need to manually modify PrestaShop files. This instruction is tested on PrestaShop version 1.7.6.7.

To show customer email address in PrestaShop PDF invoice, edit file

vi classes/pdf/HTMLTemplateInvoice.php

On line 329, find

        $data = array(
            'order' => $this->order,
            'order_invoice' => $this->order_invoice,
            'order_details' => $order_details,
            'carrier' => $carrier,
            'cart_rules' => $cart_rules,
            'delivery_address' => $formatted_delivery_address,
            'invoice_address' => $formatted_invoice_address,
            'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address),
            'tax_excluded_display' => $tax_excluded_display,
            'display_product_images' => $display_product_images,
            'layout' => $layout,
            'tax_tab' => $this->getTaxTabContent(),
            'customer' => $customer,
            'footer' => $footer,
            'ps_price_compute_precision' => _PS_PRICE_COMPUTE_PRECISION_,
            'round_type' => $round_type,
            'legal_free_text' => $legal_free_text,
        );  

Inside the array, add

'customer_email' => $customer->email,

PrestaShop show customer email

Now edit file pdf/invoice.addresses-tab.tpl

vi pdf/invoice.addresses-tab.tpl

Find

{$delivery_address}

Add below


{$customer_email}

Here is the modified content

{if $delivery_address}{l s='Delivery Address' d='Shop.Pdf' pdf='true'}

{$delivery_address}
{$customer_email} {/if}
{l s='Billing Address' d='Shop.Pdf' pdf='true'}

{$invoice_address}
{$customer_email}

Now if you download an invoice, the email address will show below the customer Delivery and Billing Address.

Back to PrestaShop

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *