How to add customer email to address templates in Magento 1.7.0.2

How to add customer email to address templates in Magento 1.7.0.2

August 25, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to add customer email to address templates in Magento 1.7.0.2

Adding Customer Email to Magento Invoice and Shipment PDFs

If you’re looking to add customer emails to your Magento invoice and shipment PDFs, you’ll want to modify the address templates used for these files. In this guide, we’ll show you how to do exactly that using Magento 1.7.0.2 with Firegento Pdf.

Understanding the Address Templates

Before we dive into the code changes, let’s understand what’s happening behind the scenes. When creating PDFs like invoices and shipments in Magento, it uses address templates (located under app/design/frontend/base/default/template/persistent/customer/address.phtml).

These templates define how customer addresses are displayed on the PDFs. By default, they don’t include an email field.

Identifying the Relevant Variable

To add a customer’s email to these templates, we need to find the right variable. In Magento 1.7.0.2, you can access the customer’s email using {{var address.email}}.

Why does this work? When generating the PDF, Magento passes the customer’s address data as a variable to the template. The address.email property contains the customer’s email address.

Modifying the Address Template

Now that we know what variable to use, let’s modify the address template. Open your favorite text editor and navigate to:

app/design/frontend/base/default/template/persistent/customer/address.phtml

Find this line of code in the file (it should be around line 19):

<p class="address-attributes">{{var address.street}}</p>

Just below it, add the following lines to include the customer’s email:

<p class="address-email">Email: {{var address.email}}</p>

Your modified template should now look like this:

<p class="address-attributes">{{var address.street}}</p>
<p class="address-email">Email: {{var address.email}}</p>

This code will display the customer’s email in a new paragraph below their street address.

Testing Your Changes

After making this modification, save the file and clear your Magento cache (System > Cache Management).

Now when you generate an invoice or shipment PDF for any order, it should include the customer’s email address. The email will appear directly below the street address on the PDF.

That’s it! You’ve successfully added customer emails to your Magento PDFs using a simple template modification.

Conclusion

Adding a customer’s email to invoices and shipments is an important step for enhancing customer communication. By modifying the address template, you can ensure that this critical information is included in all generated PDF files.

Remember, when working with Magento templates, it’s always best practice to create a child theme or copy the default file to a local directory before making modifications. This ensures your changes aren’t overwritten during updates.

If you’re looking for more advanced customization options or need help with other Magento tasks, feel free to contact us at LaravelCompany for expert assistance.

Happy coding!

Magento 1 Themes Email Orders

Our network