email-order-items.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * Email Order Items
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/emails/email-order-items.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.4.0
  16. */
  17. defined( 'ABSPATH' ) || exit;
  18. $text_align = is_rtl() ? 'right' : 'left';
  19. foreach ( $items as $item_id => $item ) :
  20. $product = $item->get_product();
  21. $sku = '';
  22. $purchase_note = '';
  23. $image = '';
  24. if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
  25. continue;
  26. }
  27. if ( is_object( $product ) ) {
  28. $sku = $product->get_sku();
  29. $purchase_note = $product->get_purchase_note();
  30. $image = $product->get_image( $image_size );
  31. }
  32. ?>
  33. <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_order_item_class', 'order_item', $item, $order ) ); ?>">
  34. <td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align: middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; word-wrap:break-word;">
  35. <?php
  36. // Show title/image etc.
  37. if ( $show_image ) {
  38. echo wp_kses_post( apply_filters( 'woocommerce_order_item_thumbnail', $image, $item ) );
  39. }
  40. // Product name.
  41. echo wp_kses_post( apply_filters( 'woocommerce_order_item_name', $item->get_name(), $item, false ) );
  42. // SKU.
  43. if ( $show_sku && $sku ) {
  44. echo wp_kses_post( ' (#' . $sku . ')' );
  45. }
  46. // allow other plugins to add additional product information here.
  47. do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order, $plain_text );
  48. wc_display_item_meta( $item );
  49. // allow other plugins to add additional product information here.
  50. do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, $plain_text );
  51. ?>
  52. </td>
  53. <td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;">
  54. <?php echo wp_kses_post( apply_filters( 'woocommerce_email_order_item_quantity', $item->get_quantity(), $item ) ); ?>
  55. </td>
  56. <td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;">
  57. <?php echo wp_kses_post( $order->get_formatted_line_subtotal( $item ) ); ?>
  58. </td>
  59. </tr>
  60. <?php
  61. if ( $show_purchase_note && $purchase_note ) {
  62. ?>
  63. <tr>
  64. <td colspan="3" style="text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;">
  65. <?php
  66. echo wp_kses_post( wpautop( do_shortcode( $purchase_note ) ) );
  67. ?>
  68. </td>
  69. </tr>
  70. <?php
  71. }
  72. ?>
  73. <?php endforeach; ?>