From 75bcbbf9599fb8efa0e8f1c09c1833f4c463f50c Mon Sep 17 00:00:00 2001 From: Brent Shepherd Date: Wed, 1 Feb 2017 18:12:21 -0800 Subject: [PATCH 1/2] Maintain old show/hide email order item logic When SHA: 7b3a9b introduced wc_get_email_order_items(), it slightly changed the logic applied to determine whether to display: * download links; and * purchase notes. In WC 2.6.13 and older, WC_Abstract_Order::email_order_items_table() would only display download links and purchase note in emails *not* sent to the admin. This patch preserves that behaviour. --- includes/wc-template-functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index 235c26bb92a..13a408278b8 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -2370,9 +2370,9 @@ if ( ! function_exists( 'wc_get_email_order_items' ) ) { wc_get_template( $template, array( 'order' => $order, 'items' => $order->get_items(), - 'show_download_links' => $order->is_download_permitted(), + 'show_download_links' => $order->is_download_permitted() && ! $args['sent_to_admin'], 'show_sku' => $args['show_sku'], - 'show_purchase_note' => $order->is_paid(), + 'show_purchase_note' => $order->is_paid() && ! $args['sent_to_admin'], 'show_image' => $args['show_image'], 'image_size' => $args['image_size'], 'plain_text' => $args['plain_text'], From fe7e280ea00902e01681bf638eca86066e8270d5 Mon Sep 17 00:00:00 2001 From: Brent Shepherd Date: Thu, 2 Feb 2017 12:12:30 -0800 Subject: [PATCH 2/2] Reinstate woocommerce_email_order_items_args hook --- includes/wc-template-functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index 13a408278b8..9b76a7bc6db 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -2367,7 +2367,7 @@ if ( ! function_exists( 'wc_get_email_order_items' ) ) { $args = wp_parse_args( $args, $defaults ); $template = $args['plain_text'] ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php'; - wc_get_template( $template, array( + wc_get_template( $template, apply_filters( 'woocommerce_email_order_items_args', array( 'order' => $order, 'items' => $order->get_items(), 'show_download_links' => $order->is_download_permitted() && ! $args['sent_to_admin'], @@ -2377,7 +2377,7 @@ if ( ! function_exists( 'wc_get_email_order_items' ) ) { 'image_size' => $args['image_size'], 'plain_text' => $args['plain_text'], 'sent_to_admin' => $args['sent_to_admin'], - ) ); + ) ) ); return apply_filters( 'woocommerce_email_order_items_table', ob_get_clean(), $order ); }