From 90297a09afd625d1a7352521607f174654e115fc Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 6 Oct 2014 12:17:07 +0100 Subject: [PATCH] [2.2] When formatting meta data for display, suffix items to prevent issues when there are multiple values for the same meta key Fixes #6404 --- includes/class-wc-order-item-meta.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/class-wc-order-item-meta.php b/includes/class-wc-order-item-meta.php index 7da103617c4..994bb06ba1b 100644 --- a/includes/class-wc-order-item-meta.php +++ b/includes/class-wc-order-item-meta.php @@ -139,7 +139,15 @@ class WC_Order_Item_Meta { } } - $formatted_meta[ $meta_key ] = array( + // Unique key required + $formatted_meta_key = $meta_key; + $loop = 0; + while ( isset( $formatted_meta[ $formatted_meta_key ] ) ) { + $loop ++; + $formatted_meta_key = $meta_key . '-' . $loop; + } + + $formatted_meta[ $formatted_meta_key ] = array( 'label' => wc_attribute_label( $attribute_key ), 'value' => apply_filters( 'woocommerce_order_item_display_meta_value', $meta_value ), );