Brak opisu

email-order-items.php 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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.7.0
  16. */
  17. defined( 'ABSPATH' ) || exit;
  18. $text_align = is_rtl() ? 'right' : 'left';
  19. $margin_side = is_rtl() ? 'left' : 'right';
  20. foreach ( $items as $item_id => $item ) :
  21. $product = $item->get_product();
  22. $sku = '';
  23. $purchase_note = '';
  24. $image = '';
  25. if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
  26. continue;
  27. }
  28. if ( is_object( $product ) ) {
  29. $sku = $product->get_sku();
  30. $purchase_note = $product->get_purchase_note();
  31. $image = $product->get_image( $image_size );
  32. }
  33. ?>
  34. <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_order_item_class', 'order_item', $item, $order ) ); ?>">
  35. <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;">
  36. <?php
  37. // Show title/image etc.
  38. if ( $show_image ) {
  39. echo wp_kses_post( apply_filters( 'woocommerce_order_item_thumbnail', $image, $item ) );
  40. }
  41. // Product name.
  42. echo wp_kses_post( apply_filters( 'woocommerce_order_item_name', $item->get_name(), $item, false ) );
  43. // SKU.
  44. if ( $show_sku && $sku ) {
  45. echo wp_kses_post( ' (#' . $sku . ')' );
  46. }
  47. // allow other plugins to add additional product information here.
  48. do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order, $plain_text );
  49. wc_display_item_meta(
  50. $item,
  51. array(
  52. 'label_before' => '<strong class="wc-item-meta-label" style="float: ' . esc_attr( $text_align ) . '; margin-' . esc_attr( $margin_side ) . ': .25em; clear: both">',
  53. )
  54. );
  55. // allow other plugins to add additional product information here.
  56. do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, $plain_text );
  57. ?>
  58. </td>
  59. <td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;">
  60. <?php
  61. $qty = $item->get_quantity();
  62. $refunded_qty = $order->get_qty_refunded_for_item( $item_id );
  63. if ( $refunded_qty ) {
  64. $qty_display = '<del>' . esc_html( $qty ) . '</del> <ins>' . esc_html( $qty - ( $refunded_qty * -1 ) ) . '</ins>';
  65. } else {
  66. $qty_display = esc_html( $qty );
  67. }
  68. echo wp_kses_post( apply_filters( 'woocommerce_email_order_item_quantity', $qty_display, $item ) );
  69. ?>
  70. </td>
  71. <td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;">
  72. <?php echo wp_kses_post( $order->get_formatted_line_subtotal( $item ) ); ?>
  73. </td>
  74. </tr>
  75. <?php
  76. if ( $show_purchase_note && $purchase_note ) {
  77. ?>
  78. <tr>
  79. <td colspan="3" style="text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;">
  80. <?php
  81. echo wp_kses_post( wpautop( do_shortcode( $purchase_note ) ) );
  82. ?>
  83. </td>
  84. </tr>
  85. <?php
  86. }
  87. ?>
  88. <?php endforeach; ?>