form-tracking.php
7 years ago
order-again.php
7 years ago
order-details-customer.php
6 years ago
order-details-item.php
6 years ago
order-details.php
6 years ago
order-downloads.php
7 years ago
tracking.php
6 years ago
order-details.php
107 lines
| 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 3.7.0 |
| 16 | */ |
| 17 | |
| 18 | defined( 'ABSPATH' ) || exit; |
| 19 | |
| 20 | $order = wc_get_order( $order_id ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited |
| 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 = is_user_logged_in() && $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 | if ( $show_downloads ) { |
| 33 | wc_get_template( |
| 34 | 'order/order-downloads.php', |
| 35 | array( |
| 36 | 'downloads' => $downloads, |
| 37 | 'show_title' => true, |
| 38 | ) |
| 39 | ); |
| 40 | } |
| 41 | ?> |
| 42 | <section class="woocommerce-order-details"> |
| 43 | <?php do_action( 'woocommerce_order_details_before_order_table', $order ); ?> |
| 44 | |
| 45 | <h2 class="woocommerce-order-details__title"><?php esc_html_e( 'Order details', 'woocommerce' ); ?></h2> |
| 46 | |
| 47 | <table class="woocommerce-table woocommerce-table--order-details shop_table order_details"> |
| 48 | |
| 49 | <thead> |
| 50 | <tr> |
| 51 | <th class="woocommerce-table__product-name product-name"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th> |
| 52 | <th class="woocommerce-table__product-table product-total"><?php esc_html_e( 'Total', 'woocommerce' ); ?></th> |
| 53 | </tr> |
| 54 | </thead> |
| 55 | |
| 56 | <tbody> |
| 57 | <?php |
| 58 | do_action( 'woocommerce_order_details_before_order_table_items', $order ); |
| 59 | |
| 60 | foreach ( $order_items as $item_id => $item ) { |
| 61 | $product = $item->get_product(); |
| 62 | |
| 63 | wc_get_template( |
| 64 | 'order/order-details-item.php', |
| 65 | array( |
| 66 | 'order' => $order, |
| 67 | 'item_id' => $item_id, |
| 68 | 'item' => $item, |
| 69 | 'show_purchase_note' => $show_purchase_note, |
| 70 | 'purchase_note' => $product ? $product->get_purchase_note() : '', |
| 71 | 'product' => $product, |
| 72 | ) |
| 73 | ); |
| 74 | } |
| 75 | |
| 76 | do_action( 'woocommerce_order_details_after_order_table_items', $order ); |
| 77 | ?> |
| 78 | </tbody> |
| 79 | |
| 80 | <tfoot> |
| 81 | <?php |
| 82 | foreach ( $order->get_order_item_totals() as $key => $total ) { |
| 83 | ?> |
| 84 | <tr> |
| 85 | <th scope="row"><?php echo esc_html( $total['label'] ); ?></th> |
| 86 | <td><?php echo ( 'payment_method' === $key ) ? esc_html( $total['value'] ) : wp_kses_post( $total['value'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td> |
| 87 | </tr> |
| 88 | <?php |
| 89 | } |
| 90 | ?> |
| 91 | <?php if ( $order->get_customer_note() ) : ?> |
| 92 | <tr> |
| 93 | <th><?php esc_html_e( 'Note:', 'woocommerce' ); ?></th> |
| 94 | <td><?php echo wp_kses_post( nl2br( wptexturize( $order->get_customer_note() ) ) ); ?></td> |
| 95 | </tr> |
| 96 | <?php endif; ?> |
| 97 | </tfoot> |
| 98 | </table> |
| 99 | |
| 100 | <?php do_action( 'woocommerce_order_details_after_order_table', $order ); ?> |
| 101 | </section> |
| 102 | |
| 103 | <?php |
| 104 | if ( $show_customer_details ) { |
| 105 | wc_get_template( 'order/order-details-customer.php', array( 'order' => $order ) ); |
| 106 | } |
| 107 |