From d067c2148d26ce81dd7e5a7911e91a6c6f23cd79 Mon Sep 17 00:00:00 2001 From: Peter Fabian Date: Tue, 15 Jan 2019 11:13:43 +0100 Subject: [PATCH] Added sorting of segments so that they have predictable order. --- .../data-stores/class-wc-admin-reports-orders-data-store.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce-admin/includes/data-stores/class-wc-admin-reports-orders-data-store.php b/plugins/woocommerce-admin/includes/data-stores/class-wc-admin-reports-orders-data-store.php index f963d124609..432509c8c22 100644 --- a/plugins/woocommerce-admin/includes/data-stores/class-wc-admin-reports-orders-data-store.php +++ b/plugins/woocommerce-admin/includes/data-stores/class-wc-admin-reports-orders-data-store.php @@ -584,7 +584,9 @@ class WC_Admin_Reports_Orders_Data_Store extends WC_Admin_Reports_Data_Store imp } // Using array_values to remove custom keys, so that it gets later converted to JSON as an array. - return array_values( $segments ); + $segments_no_keys = array_values( $segments ); + $this->sort_array( $segments_no_keys, 'segment_id', 'asc' ); + return $segments_no_keys; } /**