email-order-details.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * Order details table shown in emails.
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/emails/email-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/Emails
  15. * @version 3.3.1
  16. */
  17. if ( ! defined( 'ABSPATH' ) ) {
  18. exit;
  19. }
  20. $text_align = is_rtl() ? 'right' : 'left';
  21. do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>
  22. <h2>
  23. <?php
  24. if ( $sent_to_admin ) {
  25. $before = '<a class="link" href="' . esc_url( $order->get_edit_order_url() ) . '">';
  26. $after = '</a>';
  27. } else {
  28. $before = '';
  29. $after = '';
  30. }
  31. /* translators: %s: Order ID. */
  32. echo wp_kses_post( $before . sprintf( __( 'Order #%s', 'woocommerce' ) . $after . ' (<time datetime="%s">%s</time>)', $order->get_order_number(), $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ) );
  33. ?>
  34. </h2>
  35. <div style="margin-bottom: 40px;">
  36. <table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" border="1">
  37. <thead>
  38. <tr>
  39. <th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
  40. <th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
  41. <th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
  42. </tr>
  43. </thead>
  44. <tbody>
  45. <?php
  46. echo wc_get_email_order_items( $order, array( // WPCS: XSS ok.
  47. 'show_sku' => $sent_to_admin,
  48. 'show_image' => false,
  49. 'image_size' => array( 32, 32 ),
  50. 'plain_text' => $plain_text,
  51. 'sent_to_admin' => $sent_to_admin,
  52. ) );
  53. ?>
  54. </tbody>
  55. <tfoot>
  56. <?php
  57. $totals = $order->get_order_item_totals();
  58. if ( $totals ) {
  59. $i = 0;
  60. foreach ( $totals as $total ) {
  61. $i++;
  62. ?>
  63. <tr>
  64. <th class="td" scope="row" colspan="2" style="text-align:<?php echo esc_attr( $text_align ); ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo wp_kses_post( $total['label'] ); ?></th>
  65. <td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo wp_kses_post( $total['value'] ); ?></td>
  66. </tr>
  67. <?php
  68. }
  69. }
  70. if ( $order->get_customer_note() ) {
  71. ?>
  72. <tr>
  73. <th class="td" scope="row" colspan="2" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Note:', 'woocommerce' ); ?></th>
  74. <td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php echo wp_kses_post( wptexturize( $order->get_customer_note() ) ); ?></td>
  75. </tr>
  76. <?php
  77. }
  78. ?>
  79. </tfoot>
  80. </table>
  81. </div>
  82. <?php do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>