Add shipping phone to user facing emails

This commit is contained in:
Mike Jolley 2021-06-03 13:55:56 +01:00
parent e168702bb3
commit d19c31dee3
3 changed files with 14 additions and 1 deletions

View File

@ -42,7 +42,12 @@ $shipping = $order->get_formatted_shipping_address();
<td style="text-align:<?php echo esc_attr( $text_align ); ?>; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; padding:0;" valign="top" width="50%">
<h2><?php esc_html_e( 'Shipping address', 'woocommerce' ); ?></h2>
<address class="address"><?php echo wp_kses_post( $shipping ); ?></address>
<address class="address">
<?php echo wp_kses_post( $shipping ); ?>
<?php if ( $order->get_shipping_phone() ) : ?>
<br/><?php echo wc_make_phone_clickable( $order->get_shipping_phone() ); ?>
<?php endif; ?>
</address>
</td>
<?php endif; ?>
</tr>

View File

@ -34,5 +34,9 @@ if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() ) {
if ( $shipping ) {
echo "\n" . esc_html( wc_strtoupper( esc_html__( 'Shipping address', 'woocommerce' ) ) ) . "\n\n";
echo preg_replace( '#<br\s*/?>#i', "\n", $shipping ) . "\n"; // WPCS: XSS ok.
if ( $order->get_shipping_phone() ) {
echo $order->get_shipping_phone() . "\n"; // WPCS: XSS ok.
}
}
}

View File

@ -50,6 +50,10 @@ $show_shipping = ! wc_ship_to_billing_address_only() && $order->needs_shipping_a
<h2 class="woocommerce-column__title"><?php esc_html_e( 'Shipping address', 'woocommerce' ); ?></h2>
<address>
<?php echo wp_kses_post( $order->get_formatted_shipping_address( esc_html__( 'N/A', 'woocommerce' ) ) ); ?>
<?php if ( $order->get_shipping_phone() ) : ?>
<p class="woocommerce-customer-details--phone"><?php echo esc_html( $order->get_shipping_phone() ); ?></p>
<?php endif; ?>
</address>
</div><!-- /.col-2 -->