Customizing Shopify Invoices: How to Display Customer Email Correctly
Hey everyone! As a Shopify migration expert and someone who spends a lot of time digging through community discussions, I often see common questions pop up that, while seemingly small, can make a huge difference in your day-to-day operations and customer communication. One such topic recently caught my eye in the Shopify forums: how to add a customer's email address to your store's invoices and, crucially, how to make sure it looks right.
You know how it goes – you want to provide all the necessary details to your customers, and sometimes the default invoice template just doesn't quite cut it. FrankB1, a fellow store owner, ran into this exact scenario. He was trying to add the customer's email to his invoices generated by the Shopify Invoice App, which is a really smart move for clear record-keeping and customer service. But he hit a snag: the email address kept appearing right next to the customer's phone number, instead of neatly underneath it.
The Invoice Formatting Conundrum: Email and Phone on One Line
Frank shared his code snippet with the community, which looked something like this:
{{ order.shipping_address | format_address }}
{% if order.shipping_address.phone %}{{ order.shipping_address.phone }}{% endif %}
{{order.email}}
And he even provided a helpful screenshot to illustrate the problem:

It's a common little gotcha when you're working with HTML and Liquid in Shopify. You might add new lines in your code editor, expecting them to translate into new lines on the rendered page or invoice, but HTML doesn't always work that way. It tends to "collapse" whitespace, meaning multiple spaces or new lines often get treated as a single space.
The Expert Insight: Why HTML Collapses Whitespace (and How to Fix It!)
Thankfully, Moeed, a sharp Shopify Partner, jumped in with a brilliant explanation and a clean solution. As Moeed wisely pointed out, there was nothing inherently "wrong" with Frank's Liquid code itself. The issue was purely an HTML formatting quirk. To force a new line in HTML, you need to explicitly tell it to break the line. You can do this with either a Moeed provided an updated code snippet that not only fixed the line break issue but also added a nice little safeguard: Frank quickly confirmed that Moeed's code worked perfectly, solving his formatting challenge! It's a fantastic example of the Shopify community coming together to help each other out with practical, actionable advice. Ready to update your own invoices? Here's a step-by-step guide based on the community's solution: Customizing your Shopify store's documents, like invoices, is a fantastic way to enhance your brand's professionalism and provide clear information to your customers. It's these little tweaks that often make a big difference in the customer experience and streamline your operations. If you're looking to start your own online store and haven't chosen a platform yet, Shopify makes it incredibly easy to get started and offers a ton of flexibility for customization, even for those who aren't coding wizards. This community discussion is a perfect example of how even small coding challenges have straightforward solutions with a bit of expert guidance! tag or by wrapping each element you want on its own line in a block-level HTML element, like a {% if order.shipping_address %}
Breaking Down Moeed's Solution:
{{ order.shipping_address.phone }} and {{ order.email }} in their own {% if %}): This is a really important best practice! Moeed wrapped the email display in an {% if order.email %}...{% endif %} statement. Why? Because not every order will have an email address (think manual orders or Point of Sale transactions). This conditional check prevents an empty line or blank space from appearing on invoices where no email is present, keeping your invoices clean and professional. He also added an outer {% if order.shipping_address %} to ensure the whole block only renders if there's a shipping address.{{ "invoice_template.ship_to_label" | t }} and {{ order.shipping_address | format_address }} which are crucial for a complete shipping address block.How to Implement This in Your Shopify Invoice Template
order.shipping_address or order.shipping_address.phone.
{% if order.shipping_address %}
Start with the tools
Explore migration tools
See options, compare methods, and pick the path that fits your store.