0

How can I format the billing address in the order email to be clear?

I need to display the followings:

  • City: {billing_city}
  • Street: {billing_street}
  • and so on.

Can you please help?

Ruvee
  • 8,611
  • 4
  • 18
  • 44

1 Answers1

0

You need to copy Woocommerce email template files to your theme (if you dont have them) or edit existing ones in your template. Template file names are:

template_name/woocommerce/emails/email-order-details.php
template_name/woocommerce/emails/email-order-items.php
template_name/woocommerce/emails/email-addresses.php

Here you can customize the email template as you wish.

For example in email/email-adresses.php by default billing information code part look like this:

<td style="text-align:<?php echo esc_attr( $text_align ); ?>; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; border:0; padding:0;" valign="top" width="50%">
            <h2><?php esc_html_e( 'Billing address', 'woocommerce' ); ?></h2>

            <address class="address">
                <?php echo wp_kses_post( $address ? $address : esc_html__( 'N/A', 'woocommerce' ) ); ?>
                <?php if ( $order->get_billing_phone() ) : ?>
                    <br/><?php echo wc_make_phone_clickable( $order->get_billing_phone() ); ?>
                <?php endif; ?>
                <?php if ( $order->get_billing_email() ) : ?>
                    <br/><?php echo esc_html( $order->get_billing_email() ); ?>
                <?php endif; ?>
            </address>
    </td>

So you can customize and add/remove all information you need.

Elman Huseynov
  • 1,127
  • 1
  • 8
  • 18