admin-cancelled-order.php
1 year ago
admin-failed-order.php
1 year ago
admin-new-order.php
1 year ago
admin-payment-gateway-enabled.php
2 months ago
customer-cancelled-order.php
1 year ago
customer-completed-order.php
1 year ago
customer-failed-order.php
1 year ago
customer-fulfillment-created.php
11 months ago
customer-fulfillment-deleted.php
11 months ago
customer-fulfillment-updated.php
1 month ago
customer-invoice.php
1 year ago
customer-new-account.php
1 year ago
customer-note.php
11 months ago
customer-on-hold-order.php
1 year ago
customer-pos-completed-order.php
1 year ago
customer-pos-refunded-order.php
1 year ago
customer-processing-order.php
1 year ago
customer-refunded-order.php
1 year ago
customer-reset-password.php
1 year ago
customer-stock-notification-verified.php
9 months ago
customer-stock-notification-verify.php
9 months ago
customer-stock-notification.php
9 months ago
email-addresses.php
2 years ago
email-customer-details.php
2 years ago
email-downloads.php
2 years ago
email-fulfillment-details.php
11 months ago
email-fulfillment-items.php
1 month ago
email-order-details.php
1 month ago
email-order-items.php
1 month ago
email-order-details.php
94 lines
| 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://woocommerce.com/document/template-structure/ |
| 14 | * @package WooCommerce\Templates\Emails |
| 15 | * @version 10.8.0 |
| 16 | */ |
| 17 | |
| 18 | use Automattic\WooCommerce\Utilities\FeaturesUtil; |
| 19 | |
| 20 | defined( 'ABSPATH' ) || exit; |
| 21 | |
| 22 | $email_improvements_enabled = FeaturesUtil::feature_is_enabled( 'email_improvements' ); |
| 23 | |
| 24 | if ( $email_improvements_enabled ) { |
| 25 | add_filter( 'woocommerce_order_shipping_to_display_shipped_via', '__return_false' ); |
| 26 | } |
| 27 | |
| 28 | do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); |
| 29 | |
| 30 | /** |
| 31 | * Filter whether to display the order number in the order details heading of emails. |
| 32 | * |
| 33 | * @since 10.8.0 |
| 34 | * @param bool $display Whether to display the order number. Default true. |
| 35 | * @param WC_Order $order Order object. |
| 36 | * @param WC_Email $email Email object. |
| 37 | */ |
| 38 | if ( (bool) apply_filters( 'woocommerce_email_display_order_number', true, $order, $email ) ) { |
| 39 | if ( $email_improvements_enabled ) { |
| 40 | /* translators: %1$s: Order ID. %2$s: Order date */ |
| 41 | echo wp_kses_post( sprintf( esc_html__( 'Order #%1$s (%2$s)', 'woocommerce' ), $order->get_order_number(), wc_format_datetime( $order->get_date_created() ) ) ) . "\n"; |
| 42 | echo "\n==========\n"; |
| 43 | } else { |
| 44 | /* translators: %1$s: Order ID. %2$s: Order date */ |
| 45 | echo wp_kses_post( wc_strtoupper( sprintf( esc_html__( '[Order #%1$s] (%2$s)', 'woocommerce' ), $order->get_order_number(), wc_format_datetime( $order->get_date_created() ) ) ) ) . "\n"; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | echo "\n" . wc_get_email_order_items( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 50 | $order, |
| 51 | array( |
| 52 | 'show_sku' => $sent_to_admin, |
| 53 | 'show_image' => false, |
| 54 | 'image_size' => array( 32, 32 ), |
| 55 | 'plain_text' => true, |
| 56 | 'sent_to_admin' => $sent_to_admin, |
| 57 | ) |
| 58 | ); |
| 59 | |
| 60 | echo "==========\n\n"; |
| 61 | |
| 62 | $item_totals = $order->get_order_item_totals(); |
| 63 | |
| 64 | if ( $item_totals ) { |
| 65 | foreach ( $item_totals as $total ) { |
| 66 | if ( $email_improvements_enabled ) { |
| 67 | $label = $total['label']; |
| 68 | if ( isset( $total['meta'] ) ) { |
| 69 | $label .= ' ' . $total['meta']; |
| 70 | } |
| 71 | echo wp_kses_post( str_pad( wp_kses_post( $label ), 40 ) ); |
| 72 | echo ' '; |
| 73 | echo esc_html( str_pad( wp_kses( $total['value'], array() ), 20, ' ', STR_PAD_LEFT ) ) . "\n"; |
| 74 | } else { |
| 75 | echo wp_kses_post( $total['label'] . "\t " . $total['value'] ) . "\n"; |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | if ( $order->get_customer_note() ) { |
| 81 | if ( $email_improvements_enabled ) { |
| 82 | echo "\n" . esc_html__( 'Note:', 'woocommerce' ) . "\n" . wp_kses( wc_wptexturize_order_note( $order->get_customer_note() ), array() ) . "\n"; |
| 83 | } else { |
| 84 | echo esc_html__( 'Note:', 'woocommerce' ) . "\t " . wp_kses( wc_wptexturize_order_note( $order->get_customer_note() ), array() ) . "\n"; |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | if ( $sent_to_admin ) { |
| 89 | /* translators: %s: Order link. */ |
| 90 | echo "\n" . sprintf( esc_html__( 'View order: %s', 'woocommerce' ), esc_url( $order->get_edit_order_url() ) ) . "\n"; |
| 91 | } |
| 92 | |
| 93 | do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text, $email ); |
| 94 |