From 4e0961333f78186fca68aeba4703f2d94c85ae69 Mon Sep 17 00:00:00 2001 From: Florian Ludwig Date: Mon, 31 Aug 2015 17:59:41 +0200 Subject: [PATCH] Restored wc<2.4 behavior of order item meta keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous version of woocommerce showed the machine readable names in item_meta['key’] especially for the custom variation attributes but after 2.4 it shows only meta ids in the key. This commit reverts the behavior to the prior 2.4 behavior. --- includes/api/class-wc-api-orders.php | 2 +- includes/api/v2/class-wc-api-orders.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/api/class-wc-api-orders.php b/includes/api/class-wc-api-orders.php index 20cacf35b1e..1bca40bb787 100644 --- a/includes/api/class-wc-api-orders.php +++ b/includes/api/class-wc-api-orders.php @@ -232,7 +232,7 @@ class WC_API_Orders extends WC_API_Resource { foreach ( $meta->get_formatted( $hideprefix ) as $meta_key => $formatted_meta ) { $item_meta[] = array( - 'key' => $meta_key, + 'key' => $formatted_meta['key'], 'label' => $formatted_meta['label'], 'value' => $formatted_meta['value'], ); diff --git a/includes/api/v2/class-wc-api-orders.php b/includes/api/v2/class-wc-api-orders.php index 901f9f1e628..a0f90e3f5ba 100644 --- a/includes/api/v2/class-wc-api-orders.php +++ b/includes/api/v2/class-wc-api-orders.php @@ -232,7 +232,7 @@ class WC_API_Orders extends WC_API_Resource { foreach ( $meta->get_formatted( $hideprefix ) as $meta_key => $formatted_meta ) { $item_meta[] = array( - 'key' => $meta_key, + 'key' => $formatted_meta['key'], 'label' => $formatted_meta['label'], 'value' => $formatted_meta['value'], );