Skip to content

Commit b172d25

Browse files
committed
Updated order data meta column
1 parent e75e830 commit b172d25

File tree

1 file changed

+59
-4
lines changed

1 file changed

+59
-4
lines changed

admin/partials/wc-order-view-order-details-display.php

+59-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121

2222
defined( 'ABSPATH' ) || exit;
2323

24+
if ( WC()->payment_gateways() ) {
25+
$payment_gateways = WC()->payment_gateways->payment_gateways();
26+
} else {
27+
$payment_gateways = array();
28+
}
29+
30+
$payment_method = $order->get_payment_method();
31+
2432
$payment_gateway = wc_get_payment_gateway_by_order( $order );
2533
$line_items = $order->get_items( apply_filters( 'woocommerce_admin_order_item_types', 'line_item' ) );
2634
$discounts = $order->get_items( 'discount' );
@@ -101,8 +109,51 @@
101109
<div id="woocommerce-order-data" class="postbox">
102110
<div class="inside">
103111
<div id="order_data" class="panel woocommerce-order-data">
104-
<h2 class="woocommerce-order-data__heading">Order #<?php echo $order->get_id(); ?> details</h2>
105-
<p class="woocommerce-order-data__meta order_number"> Payment via <?php echo $order->get_payment_method_title(); ?>. Paid on <?php echo $order->get_date_created()->format ('F j, Y @ g:i a'); ?></p>
112+
<h2 class="woocommerce-order-data__heading">
113+
<h2 class="woocommerce-order-data__heading">
114+
<?php
115+
/* translators: 1: order number */
116+
printf(
117+
esc_html__( 'Order #%1$s details', 'wc-order-view' ),
118+
esc_html( $order->get_order_number() )
119+
);
120+
?>
121+
</h2>
122+
</h2>
123+
<p class="woocommerce-order-data__meta order_number">
124+
<?php
125+
126+
$meta_list = array();
127+
if ( $payment_method && 'other' !== $payment_method ) {
128+
/* translators: %s: payment method */
129+
$payment_method_string = sprintf(
130+
__( 'Payment via %s', 'wc-order-view' ),
131+
esc_html( isset( $payment_gateways[ $payment_method ] ) ? $payment_gateways[ $payment_method ]->get_title() : $payment_method )
132+
);
133+
if ( $transaction_id = $order->get_transaction_id() ) {
134+
$payment_method_string .= ' (' . esc_html( $transaction_id ) . ')';
135+
}
136+
$meta_list[] = $payment_method_string;
137+
}
138+
if ( $order->get_date_paid() ) {
139+
/* translators: 1: date 2: time */
140+
$meta_list[] = sprintf(
141+
__( 'Paid on %1$s @ %2$s', 'wc-order-view' ),
142+
wc_format_datetime( $order->get_date_paid() ),
143+
wc_format_datetime( $order->get_date_paid(), get_option( 'time_format' ) )
144+
);
145+
}
146+
if ( $ip_address = $order->get_customer_ip_address() ) {
147+
/* translators: %s: IP address */
148+
$meta_list[] = sprintf(
149+
__( 'Customer IP: %s', 'wc-order-view' ),
150+
'<span class="woocommerce-Order-customerIP">' . esc_html( $ip_address ) . '</span>'
151+
);
152+
}
153+
echo wp_kses_post( implode( '. ', $meta_list ) );
154+
155+
?>
156+
</p>
106157
<div class="order_data_column_container">
107158
<div class="order_data_column">
108159
<h3>General</h3>
@@ -127,7 +178,11 @@
127178
<div class="order_data_column">
128179
<h3>Billing</h3>
129180
<div class="address">
130-
<p><?php echo $order->get_formatted_billing_address(); ?></p>
181+
<?php if( ! empty( $order->get_formatted_billing_address() ) ) : ?>
182+
<p><?php echo $order->get_formatted_billing_address(); ?></p>
183+
<?php else : ?>
184+
<p class="none_set"><strong>Address:</strong>No billing address set.</p>
185+
<?php endif; ?>
131186
<p>
132187
<strong>Email Address:</strong>
133188
<a href="mailto:<?php echo $order->get_billing_email(); ?>"><?php echo $order->get_billing_email(); ?></a>
@@ -141,7 +196,7 @@
141196
<div class="order_data_column">
142197
<h3>Shipping</h3>
143198
<div class="address">
144-
<?php if( !empty( $order->get_formatted_shipping_address() ) ) : ?>
199+
<?php if( ! empty( $order->get_formatted_shipping_address() ) ) : ?>
145200
<p><?php echo $order->get_formatted_shipping_address(); ?></p>
146201
<?php else : ?>
147202
<p class="none_set"><strong>Address:</strong>No shipping address set.</p>

0 commit comments

Comments
 (0)