form-tracking.php
7 years ago
order-again.php
7 years ago
order-details-customer.php
7 years ago
order-details-item.php
7 years ago
order-details.php
7 years ago
order-downloads.php
7 years ago
tracking.php
7 years ago
order-details.php
97 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.5.2 |
| 16 | */ |
| 17 | |
| 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 19 | exit; |
| 20 | } |
| 21 | if ( ! $order = wc_get_order( $order_id ) ) { |
| 22 | return; |
| 23 | } |
| 24 | |
| 25 | $order_items = $order->get_items( apply_filters( 'woocommerce_purchase_order_item_types', 'line_item' ) ); |
| 26 | $show_purchase_note = $order->has_status( apply_filters( 'woocommerce_purchase_note_order_statuses', array( 'completed', 'processing' ) ) ); |
| 27 | $show_customer_details = is_user_logged_in() && $order->get_user_id() === get_current_user_id(); |
| 28 | $downloads = $order->get_downloadable_items(); |
| 29 | $show_downloads = $order->has_downloadable_item() && $order->is_download_permitted(); |
| 30 | |
| 31 | if ( $show_downloads ) { |
| 32 | wc_get_template( 'order/order-downloads.php', array( 'downloads' => $downloads, 'show_title' => true ) ); |
| 33 | } |
| 34 | ?> |
| 35 | <section class="woocommerce-order-details"> |
| 36 | <?php do_action( 'woocommerce_order_details_before_order_table', $order ); ?> |
| 37 | |
| 38 | <h2 class="woocommerce-order-details__title"><?php _e( 'Order details', 'woocommerce' ); ?></h2> |
| 39 | |
| 40 | <table class="woocommerce-table woocommerce-table--order-details shop_table order_details"> |
| 41 | |
| 42 | <thead> |
| 43 | <tr> |
| 44 | <th class="woocommerce-table__product-name product-name"><?php _e( 'Product', 'woocommerce' ); ?></th> |
| 45 | <th class="woocommerce-table__product-table product-total"><?php _e( 'Total', 'woocommerce' ); ?></th> |
| 46 | </tr> |
| 47 | </thead> |
| 48 | |
| 49 | <tbody> |
| 50 | <?php |
| 51 | do_action( 'woocommerce_order_details_before_order_table_items', $order ); |
| 52 | |
| 53 | foreach ( $order_items as $item_id => $item ) { |
| 54 | $product = $item->get_product(); |
| 55 | |
| 56 | wc_get_template( 'order/order-details-item.php', array( |
| 57 | 'order' => $order, |
| 58 | 'item_id' => $item_id, |
| 59 | 'item' => $item, |
| 60 | 'show_purchase_note' => $show_purchase_note, |
| 61 | 'purchase_note' => $product ? $product->get_purchase_note() : '', |
| 62 | 'product' => $product, |
| 63 | ) ); |
| 64 | } |
| 65 | |
| 66 | do_action( 'woocommerce_order_details_after_order_table_items', $order ); |
| 67 | ?> |
| 68 | </tbody> |
| 69 | |
| 70 | <tfoot> |
| 71 | <?php |
| 72 | foreach ( $order->get_order_item_totals() as $key => $total ) { |
| 73 | ?> |
| 74 | <tr> |
| 75 | <th scope="row"><?php echo $total['label']; ?></th> |
| 76 | <td><?php echo ( 'payment_method' === $key ) ? esc_html( $total['value'] ) : $total['value']; ?></td> |
| 77 | </tr> |
| 78 | <?php |
| 79 | } |
| 80 | ?> |
| 81 | <?php if ( $order->get_customer_note() ) : ?> |
| 82 | <tr> |
| 83 | <th><?php _e( 'Note:', 'woocommerce' ); ?></th> |
| 84 | <td><?php echo wptexturize( $order->get_customer_note() ); ?></td> |
| 85 | </tr> |
| 86 | <?php endif; ?> |
| 87 | </tfoot> |
| 88 | </table> |
| 89 | |
| 90 | <?php do_action( 'woocommerce_order_details_after_order_table', $order ); ?> |
| 91 | </section> |
| 92 | |
| 93 | <?php |
| 94 | if ( $show_customer_details ) { |
| 95 | wc_get_template( 'order/order-details-customer.php', array( 'order' => $order ) ); |
| 96 | } |
| 97 |