email-order-items.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Email Order Items (plain)
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/emails/plain/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. * @author WooThemes
  15. * @package WooCommerce/Templates/Emails/Plain
  16. * @version 3.2.0
  17. */
  18. if ( ! defined( 'ABSPATH' ) ) {
  19. exit; // Exit if accessed directly
  20. }
  21. foreach ( $items as $item_id => $item ) :
  22. if ( apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
  23. $product = $item->get_product();
  24. echo apply_filters( 'woocommerce_order_item_name', $item->get_name(), $item, false );
  25. if ( $show_sku && $product->get_sku() ) {
  26. echo ' (#' . $product->get_sku() . ')';
  27. }
  28. echo ' X ' . apply_filters( 'woocommerce_email_order_item_quantity', $item->get_quantity(), $item );
  29. echo ' = ' . $order->get_formatted_line_subtotal( $item ) . "\n";
  30. // allow other plugins to add additional product information here
  31. do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order, $plain_text );
  32. echo strip_tags( wc_display_item_meta( $item, array(
  33. 'before' => "\n- ",
  34. 'separator' => "\n- ",
  35. 'after' => "",
  36. 'echo' => false,
  37. 'autop' => false,
  38. ) ) );
  39. // allow other plugins to add additional product information here
  40. do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, $plain_text );
  41. }
  42. // Note
  43. if ( $show_purchase_note && is_object( $product ) && ( $purchase_note = $product->get_purchase_note() ) ) {
  44. echo "\n" . do_shortcode( wp_kses_post( $purchase_note ) );
  45. }
  46. echo "\n\n";
  47. endforeach;