Fix item_id notice

This commit is contained in:
Mike Jolley 2014-09-23 15:53:15 +01:00
parent 633299173d
commit 448337386f
2 changed files with 8 additions and 2 deletions

View File

@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
foreach ( $items as $item ) :
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['item_meta'], $_product );
?>

View File

@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
foreach ( $items as $item ) :
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['item_meta'], $_product );
@ -23,6 +23,9 @@ foreach ( $items as $item ) :
echo ' (#' . $_product->get_sku() . ')';
}
// allow other plugins to add additional product information here
do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order );
// Variation
echo $item_meta->meta ? "\n" . $item_meta->display( true, true ) : '';
@ -50,6 +53,9 @@ foreach ( $items as $item ) :
}
}
// allow other plugins to add additional product information here
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order );
// Note
if ( $show_purchase_note && $purchase_note = get_post_meta( $_product->id, '_purchase_note', true ) ) {
echo "\n" . $purchase_note;