email-order-details.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Order details table shown in emails.
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/emails/plain/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.4.0
  16. */
  17. if ( ! defined( 'ABSPATH' ) ) {
  18. exit;
  19. }
  20. do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email );
  21. /* translators: %s: Order ID. */
  22. echo wp_kses_post( wc_strtoupper( sprintf( __( 'Order number: %s', 'woocommerce' ), $order->get_order_number() ) ) ) . "\n";
  23. echo wc_format_datetime( $order->get_date_created() ) . "\n"; // WPCS: XSS ok.
  24. echo "\n" . wc_get_email_order_items( $order, array( // WPCS: XSS ok.
  25. 'show_sku' => $sent_to_admin,
  26. 'show_image' => false,
  27. 'image_size' => array( 32, 32 ),
  28. 'plain_text' => true,
  29. 'sent_to_admin' => $sent_to_admin,
  30. ) );
  31. echo "==========\n\n";
  32. $totals = $order->get_order_item_totals();
  33. if ( $totals ) {
  34. foreach ( $totals as $total ) {
  35. echo wp_kses_post( $total['label'] . "\t " . $total['value'] ) . "\n";
  36. }
  37. }
  38. if ( $order->get_customer_note() ) {
  39. echo esc_html__( 'Note:', 'woocommerce' ) . "\t " . wp_kses_post( wptexturize( $order->get_customer_note() ) ) . "\n";
  40. }
  41. if ( $sent_to_admin ) {
  42. /* translators: %s: Order link. */
  43. echo "\n" . sprintf( esc_html__( 'View order: %s', 'woocommerce' ), esc_url( $order->get_edit_order_url() ) ) . "\n";
  44. }
  45. do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text, $email );