Skip to content

Commit 7c45127

Browse files
Merge pull request #206 from TycheSoftwares/label
Fixed the display labels for shipping and billing address
2 parents 78de1c1 + 292a4b0 commit 7c45127

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

woocommerce-delivery-notes/templates/print-order/print-content.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,21 @@
3636
<address>
3737

3838
<?php
39+
3940
if ( ! $order->get_formatted_billing_address() ) {
4041
esc_attr_e( 'N/A', 'woocommerce-delivery-notes' );
4142
} else {
42-
echo wp_kses_post( apply_filters( 'wcdn_address_billing', $order->get_formatted_billing_address(), $order ) );
43+
$country = $order->get_billing_country();
44+
$state = $order->get_billing_state();
45+
$full_name_state = WC()->countries->get_states( $country )[$state];
46+
$billing_address = 'Company : ' . $order->get_billing_company() . '<br>' .
47+
'Name : ' . $order->get_formatted_billing_full_name() . '<br>' .
48+
'Address 1: ' . $order->get_billing_address_1() .',<br>' .
49+
'Address 2: ' . $order->get_billing_address_2() . ',<br>' .
50+
'City: ' . $order->get_billing_city() . ' ' . $order->get_billing_postcode() .',<br>' .
51+
'State: ' . $full_name_state . '.';
52+
53+
echo wp_kses_post( apply_filters( 'wcdn_address_billing', $billing_address , $order ) );
4354
}
4455
?>
4556

@@ -54,7 +65,17 @@
5465
if ( ! $order->get_formatted_shipping_address() ) {
5566
esc_attr_e( 'N/A', 'woocommerce-delivery-notes' );
5667
} else {
57-
echo wp_kses_post( apply_filters( 'wcdn_address_shipping', $order->get_formatted_shipping_address(), $order ) );
68+
$country = $order->get_shipping_country();
69+
$state = $order->get_shipping_state();
70+
$full_name_state = WC()->countries->get_states( $country )[$state];
71+
$shipping_address = 'Company : ' . $order->get_shipping_company() . '<br>' .
72+
'Name : ' . $order->get_formatted_shipping_full_name() . '<br>' .
73+
'Address 1: ' . $order->get_shipping_address_1() .',<br>' .
74+
'Address 2: ' . $order->get_shipping_address_2() . ',<br>' .
75+
'City: ' . $order->get_shipping_city() . ' ' . $order->get_shipping_postcode() .',<br>' .
76+
'State: ' . $full_name_state . '.' ;
77+
78+
echo wp_kses_post( apply_filters( 'wcdn_address_shipping', $shipping_address , $order ) );
5879
}
5980
?>
6081

0 commit comments

Comments
 (0)