ru-se.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

order-details.php (4215B)


      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',
     28     array( 'completed', 'processing' ) ) );
     29 $show_customer_details = is_user_logged_in() && $order->get_user_id() === get_current_user_id();
     30 $downloads             = $order->get_downloadable_items();
     31 $show_downloads        = $order->has_downloadable_item() && $order->is_download_permitted();
     32 
     33 if ( $show_downloads ) {
     34     ?>
     35     <div class="woocommerce-order-details-card">
     36         <?php wc_get_template( 'order/order-downloads.php',
     37             array( 'downloads' => $downloads, 'show_title' => true ) ); ?>
     38     </div>
     39     <?php
     40 }
     41 ?>
     42 <section class="woocommerce-order-details">
     43     <div class="woocommerce-order-details-card">
     44 
     45         <?php do_action( 'woocommerce_order_details_before_order_table', $order ); ?>
     46 
     47         <h2 class="woocommerce-order-details__title"><?php esc_html_e( 'Order details', 'materialis' ); ?></h2>
     48 
     49         <table class="woocommerce-table woocommerce-table--order-details shop_table order_details">
     50 
     51             <thead>
     52             <tr>
     53                 <th class="woocommerce-table__product-name product-name"><?php esc_html_e( 'Product', 'materialis' ); ?></th>
     54                 <th class="woocommerce-table__product-table product-total"><?php esc_html_e( 'Total', 'materialis' ); ?></th>
     55             </tr>
     56             </thead>
     57 
     58             <tbody>
     59             <?php
     60             do_action( 'woocommerce_order_details_before_order_table_items', $order );
     61 
     62             foreach ( $order_items as $item_id => $item ) {
     63             $product = $item->get_product();
     64 
     65             wc_get_template( 'order/order-details-item.php', 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             do_action( 'woocommerce_order_details_after_order_table_items', $order );
     76             ?>
     77             </tbody>
     78 
     79             <tfoot>
     80             <?php
     81             foreach ( $order->get_order_item_totals() as $key => $total ) {
     82             ?>
     83             <tr>
     84                 <th scope="row"><?php echo esc_html( $total['label'] ); ?></th>
     85                 <td><?php echo ( 'payment_method' === $key ) ? esc_html( $total['value'] ) : wp_kses_post( $total['value'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
     86             </tr>
     87             <?php
     88             }
     89             ?>
     90             <?php if ( $order->get_customer_note() ) : ?>
     91             <tr>
     92                 <th><?php esc_html_e( 'Note:', 'materialis' ); ?></th>
     93                 <td><?php echo wp_kses_post( nl2br( wptexturize( $order->get_customer_note() ) ) ); ?></td>
     94             </tr>
     95             <?php endif; ?>
     96             </tfoot>
     97         </table>
     98 
     99         <?php do_action( 'woocommerce_order_details_after_order_table', $order ); ?>
    100     </div>
    101 </section>
    102 
    103 <?php
    104 /**
    105  * Action hook fired after the order details.
    106  *
    107  * @since 4.4.0
    108  * @param WC_Order $order Order data.
    109  */
    110 do_action( 'woocommerce_after_order_details', $order );
    111 if ( $show_customer_details ) {
    112 wc_get_template( 'order/order-details-customer.php', array( 'order' => $order ) );
    113 }