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
1 |
vi classes/pdf/HTMLTemplateInvoice.php |
On line 329, find
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
$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
1 |
'customer_email' => $customer->email, |
Now edit file pdf/invoice.addresses-tab.tpl
1 |
vi pdf/invoice.addresses-tab.tpl |
Find
1 |
{$delivery_address} |
Add below
1 |
<br/>{$customer_email} |
Here is the modified content
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<table id="addresses-tab" cellspacing="0" cellpadding="0"> <tr> <td width="50%">{if $delivery_address}<span class="bold">{l s='Delivery Address' d='Shop.Pdf' pdf='true'}</span><br/><br/> {$delivery_address} <br/>{$customer_email} {/if} </td> <td width="50%"><span class="bold">{l s='Billing Address' d='Shop.Pdf' pdf='true'}</span><br/><br/> {$invoice_address} <br/>{$customer_email} </td> </tr> </table> |
Now if you download an invoice, the email address will show below the customer Delivery and Billing Address.
Back to PrestaShop