| 1 |
<?php |
| 2 |
/** |
| 3 |
* Order details |
| 4 |
* |
| 5 |
* This template can be overridden by copying it to yourtheme/woocommerce/order/order-details.php. |
| 6 |
* |
| 7 |
* HOWEVER, on occasion WooCommerce will need to update template files and you |
| 8 |
* (the theme developer) will need to copy the new files to your theme to |
| 9 |
* maintain compatibility. We try to do this as little as possible, but it does |
| 10 |
* happen. When this occurs the version of the template file will be bumped and |
| 11 |
* the readme will list any important changes. |
| 12 |
* |
| 13 |
* @see https://docs.woocommerce.com/document/template-structure/ |
| 14 |
* @package WooCommerce\Templates |
| 15 |
* @version 4.6.0 |
| 16 |
*/ |
| 17 |
|
| 18 |
defined( 'ABSPATH' ) || exit; |
| 19 |
|
| 20 |
$order = wc_get_order( $order_id ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 21 |
|
| 22 |
if ( ! $order ) { |
| 23 |
return; |
| 24 |
} |
| 25 |
|
| 26 |
$order_items = $order->get_items( apply_filters( 'woocommerce_purchase_order_item_types', 'line_item' ) ); |
| 27 |
$show_purchase_note = $order->has_status( apply_filters( 'woocommerce_purchase_note_order_statuses', array( 'completed', 'processing' ) ) ); |
| 28 |
$show_customer_details = $order->get_user_id() === get_current_user_id(); |
| 29 |
$downloads = $order->get_downloadable_items(); |
| 30 |
$show_downloads = $order->has_downloadable_item() && $order->is_download_permitted(); |
| 31 |
|
| 32 |
$thankyou_id = wcf()->flow->get_thankyou_page_id( $order ); |
| 33 |
$thankyou_layout = wcf()->options->get_thankyou_meta_value( $thankyou_id, 'wcf-tq-layout' ); |
| 34 |
|
| 35 |
// If main order is cancelled then show the new order details. |
| 36 |
if( $order->has_status( 'cancelled' ) ){ |
| 37 |
do_action( 'cartflows_woocommerce_order_details_cancelled', $order ); |
| 38 |
}else{ |
| 39 |
|
| 40 |
if ( $show_downloads ) { |
| 41 |
wc_get_template( |
| 42 |
'order/order-downloads.php', |
| 43 |
array( |
| 44 |
'downloads' => $downloads, |
| 45 |
'show_title' => true, |
| 46 |
) |
| 47 |
); |
| 48 |
} |
| 49 |
?> |
| 50 |
<section class="woocommerce-order-details"> |
| 51 |
<?php do_action( 'woocommerce_order_details_before_order_table', $order ); ?> |
| 52 |
<?php if('modern-tq-layout' === $thankyou_layout || 'tq-layout-3' === $thankyou_layout) { ?> |
| 53 |
<h2 class="woocommerce-order-details__title woocommerce-column__title"><?php esc_html_e( 'Order #', 'woocommerce' ); ?><?php echo esc_html( $order->get_order_number() ); ?></h2> |
| 54 |
<?php } else { ?> |
| 55 |
<h2 class="woocommerce-order-details__title"><?php esc_html_e( 'Order details', 'woocommerce' ); ?></h2> |
| 56 |
<?php } ?> |
| 57 |
<table class="woocommerce-table woocommerce-table--order-details shop_table order_details"> |
| 58 |
<?php if('legacy-tq-layout' === $thankyou_layout) { ?> |
| 59 |
<thead> |
| 60 |
<tr> |
| 61 |
<th class="woocommerce-table__product-name product-name"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th> |
| 62 |
<th class="woocommerce-table__product-table product-total"><?php esc_html_e( 'Total', 'woocommerce' ); ?></th> |
| 63 |
</tr> |
| 64 |
</thead> |
| 65 |
<?php } ?> |
| 66 |
<tbody> |
| 67 |
<?php |
| 68 |
do_action( 'woocommerce_order_details_before_order_table_items', $order ); |
| 69 |
|
| 70 |
foreach ( $order_items as $item_id => $item ) { |
| 71 |
$product = $item->get_product(); |
| 72 |
|
| 73 |
wc_get_template( |
| 74 |
'order/order-details-item.php', |
| 75 |
array( |
| 76 |
'order' => $order, |
| 77 |
'item_id' => $item_id, |
| 78 |
'item' => $item, |
| 79 |
'show_purchase_note' => $show_purchase_note, |
| 80 |
'purchase_note' => $product ? $product->get_purchase_note() : '', |
| 81 |
'product' => $product, |
| 82 |
) |
| 83 |
); |
| 84 |
} |
| 85 |
|
| 86 |
do_action( 'woocommerce_order_details_after_order_table_items', $order ); |
| 87 |
|
| 88 |
if('legacy-tq-layout' === $thankyou_layout) { ?> |
| 89 |
</tbody> |
| 90 |
|
| 91 |
<tfoot> |
| 92 |
<?php } |
| 93 |
|
| 94 |
foreach ( $order->get_order_item_totals() as $key => $total ) { |
| 95 |
if ( ( 'modern-tq-layout' === $thankyou_layout || 'tq-layout-3' === $thankyou_layout ) && $key === 'payment_method' ) { |
| 96 |
continue; |
| 97 |
} |
| 98 |
?> |
| 99 |
<tr> |
| 100 |
<th scope="row"><?php echo esc_html( $total['label'] ); ?></th> |
| 101 |
<?php if('modern-tq-layout' === $thankyou_layout) { ?> |
| 102 |
<td><?php echo wp_kses_post( $total['value'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td> |
| 103 |
<?php } else { ?> |
| 104 |
<td><?php echo ( 'payment_method' === $key ) ? esc_html( $total['value'] ) : wp_kses_post( $total['value'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td> |
| 105 |
<?php } ?> |
| 106 |
</tr> |
| 107 |
<?php |
| 108 |
} |
| 109 |
?> |
| 110 |
<?php if ( $order->get_customer_note() ) : ?> |
| 111 |
<tr> |
| 112 |
<th><?php esc_html_e( 'Note:', 'woocommerce' ); ?></th> |
| 113 |
<td><?php echo wp_kses_post( nl2br( wptexturize( $order->get_customer_note() ) ) ); ?></td> |
| 114 |
</tr> |
| 115 |
<?php endif; |
| 116 |
if('legacy-tq-layout' === $thankyou_layout) { ?> |
| 117 |
</tbody> |
| 118 |
|
| 119 |
<tfoot> |
| 120 |
<?php } ?> |
| 121 |
</tbody> |
| 122 |
</table> |
| 123 |
|
| 124 |
<?php do_action( 'woocommerce_order_details_after_order_table', $order ); ?> |
| 125 |
</section> |
| 126 |
<?php } ?> |
| 127 |
|
| 128 |
<?php |
| 129 |
/** |
| 130 |
* Action hook fired after the order details. |
| 131 |
* |
| 132 |
* @since 4.4.0 |
| 133 |
* @param WC_Order $order Order data. |
| 134 |
*/ |
| 135 |
do_action( 'woocommerce_after_order_details', $order ); |
| 136 |
|
| 137 |
if ( $show_customer_details ) { |
| 138 |
wc_get_template( 'order/order-details-customer.php', array( 'order' => $order ) ); |
| 139 |
} |
| 140 |
|