diff --git a/includes/abstracts/abstract-wc-legacy-order.php b/includes/abstracts/abstract-wc-legacy-order.php
index 8fe96d3435a..bbf853d02e3 100644
--- a/includes/abstracts/abstract-wc-legacy-order.php
+++ b/includes/abstracts/abstract-wc-legacy-order.php
@@ -364,7 +364,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
* @param array $item
*/
public function display_item_meta( $item ) {
- _deprecated_function( 'get_item_meta', '2.7', 'wc_display_item_meta' );
+ _deprecated_function( 'display_item_meta', '2.7', 'wc_display_item_meta' );
$product = $item->get_product();
$item_meta = new WC_Order_Item_Meta( $item, $product );
$item_meta->display();
diff --git a/templates/emails/email-order-items.php b/templates/emails/email-order-items.php
index 029c853b1d0..8976c3a4479 100644
--- a/templates/emails/email-order-items.php
+++ b/templates/emails/email-order-items.php
@@ -10,49 +10,43 @@
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
- * @see https://docs.woocommerce.com/document/template-structure/
+ * @see https://docs.woothemes.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates/Emails
- * @version 2.1.2
+ * @version 2.7.0
*/
if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly
+ exit;
}
foreach ( $items as $item_id => $item ) :
- $_product = apply_filters( 'woocommerce_order_item_product', $order->get_product_from_item( $item ), $item );
- $item_meta = new WC_Order_Item_Meta( $item, $_product );
-
if ( apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
+ $product = $item->get_product();
?>
', $item );
+ echo apply_filters( 'woocommerce_order_item_thumbnail', '', $item );
}
// Product name
echo apply_filters( 'woocommerce_order_item_name', $item['name'], $item, false );
// SKU
- if ( $show_sku && is_object( $_product ) && $_product->get_sku() ) {
- echo ' (#' . $_product->get_sku() . ')';
+ if ( $show_sku && is_object( $product ) && $product->get_sku() ) {
+ echo ' (#' . $product->get_sku() . ')';
}
// allow other plugins to add additional product information here
do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order, $plain_text );
- // Variation
- if ( ! empty( $item_meta->meta ) ) {
- echo ' ' . nl2br( $item_meta->display( true, true, '_', "\n" ) ) . '';
- }
+ wc_display_item_meta( $item );
- // File URLs
if ( $show_download_links ) {
- $order->display_item_downloads( $item );
+ wc_display_item_downloads( $item );
}
// allow other plugins to add additional product information here
@@ -65,7 +59,7 @@ foreach ( $items as $item_id => $item ) :
id, '_purchase_note', true ) ) ) : ?>
+ if ( $show_purchase_note && is_object( $product ) && ( $purchase_note = get_post_meta( $product->id, '_purchase_note', true ) ) ) : ?>
|
|
diff --git a/templates/emails/plain/email-order-items.php b/templates/emails/plain/email-order-items.php
index 2af1e0fd1b1..1bbc9438d66 100644
--- a/templates/emails/plain/email-order-items.php
+++ b/templates/emails/plain/email-order-items.php
@@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates/Emails/Plain
- * @version 2.1.2
+ * @version 2.7.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@@ -21,59 +21,38 @@ if ( ! defined( 'ABSPATH' ) ) {
}
foreach ( $items as $item_id => $item ) :
- $_product = apply_filters( 'woocommerce_order_item_product', $order->get_product_from_item( $item ), $item );
- $item_meta = new WC_Order_Item_Meta( $item, $_product );
-
if ( apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
-
- // Title
- echo apply_filters( 'woocommerce_order_item_name', $item['name'], $item, false );
-
- // SKU
- if ( $show_sku && $_product->get_sku() ) {
- echo ' (#' . $_product->get_sku() . ')';
+ $product = $item->get_product();
+ echo apply_filters( 'woocommerce_order_item_name', $item->get_name(), $item, false );
+ if ( $show_sku && $product->get_sku() ) {
+ echo ' (#' . $product->get_sku() . ')';
}
-
+ echo ' X ' . apply_filters( 'woocommerce_email_order_item_quantity', $item['qty'], $item );
+ echo ' = ' . $order->get_formatted_line_subtotal( $item ) . "\n";
// allow other plugins to add additional product information here
do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order, $plain_text );
-
- // Variation
- echo ( $item_meta_content = $item_meta->display( true, true ) ) ? "\n" . $item_meta_content : '';
-
- // Quantity
- echo "\n" . sprintf( __( 'Quantity: %s', 'woocommerce' ), apply_filters( 'woocommerce_email_order_item_quantity', $item['qty'], $item ) );
-
- // Cost
- echo "\n" . sprintf( __( 'Cost: %s', 'woocommerce' ), $order->get_formatted_line_subtotal( $item ) );
-
- // Download URLs
- if ( $show_download_links && $_product->exists() && $_product->is_downloadable() ) {
- $download_files = $order->get_item_downloads( $item );
- $i = 0;
-
- foreach ( $download_files as $download_id => $file ) {
- $i++;
-
- if ( count( $download_files ) > 1 ) {
- $prefix = sprintf( __( 'Download %d', 'woocommerce' ), $i );
- } elseif ( $i == 1 ) {
- $prefix = __( 'Download', 'woocommerce' );
- }
-
- echo "\n" . $prefix . '(' . esc_html( $file['name'] ) . '): ' . esc_url( $file['download_url'] );
- }
+ echo strip_tags( wc_display_item_meta( $item, array(
+ 'before' => "\n- ",
+ 'separator' => "\n- ",
+ 'after' => "",
+ 'echo' => false,
+ 'autop' => false,
+ ) ) );
+ if ( $show_download_links ) {
+ echo strip_tags( wc_display_item_downloads( $item, array(
+ 'before' => "\n- ",
+ 'separator' => "\n- ",
+ 'after' => "",
+ 'echo' => false,
+ 'show_url' => true,
+ ) ) );
}
-
// allow other plugins to add additional product information here
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, $plain_text );
-
}
-
// Note
- if ( $show_purchase_note && ( $purchase_note = get_post_meta( $_product->id, '_purchase_note', true ) ) ) {
+ if ( $show_purchase_note && ( $purchase_note = get_post_meta( $product->id, '_purchase_note', true ) ) ) {
echo "\n" . do_shortcode( wp_kses_post( $purchase_note ) );
}
-
echo "\n\n";
-
endforeach;
diff --git a/templates/order/order-details-item.php b/templates/order/order-details-item.php
index 69bc4bc1905..0f81cfc3c4b 100644
--- a/templates/order/order-details-item.php
+++ b/templates/order/order-details-item.php
@@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
- * @version 2.5.0
+ * @version 2.7.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@@ -35,8 +35,8 @@ if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order );
- $order->display_item_meta( $item );
- $order->display_item_downloads( $item );
+ wc_display_item_meta( $item );
+ wc_display_item_downloads( $item );
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order );
?>