From 7a6bc5f9f5a5eda6a97f85cd0c4ba2d417acf3e9 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Fri, 18 Nov 2016 16:46:59 -0200 Subject: [PATCH] Removed extra get_post() for orders --- includes/api/legacy/v1/class-wc-api-orders.php | 5 +---- includes/api/legacy/v2/class-wc-api-orders.php | 2 -- includes/api/legacy/v3/class-wc-api-orders.php | 7 +++---- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/includes/api/legacy/v1/class-wc-api-orders.php b/includes/api/legacy/v1/class-wc-api-orders.php index 4aeac9060a8..6de14480404 100644 --- a/includes/api/legacy/v1/class-wc-api-orders.php +++ b/includes/api/legacy/v1/class-wc-api-orders.php @@ -109,10 +109,7 @@ class WC_API_Orders extends WC_API_Resource { if ( is_wp_error( $id ) ) return $id; - $order = wc_get_order( $id ); - - $order_post = get_post( $id ); - + $order = wc_get_order( $id ); $order_data = array( 'id' => $order->get_id(), 'order_number' => $order->get_order_number(), diff --git a/includes/api/legacy/v2/class-wc-api-orders.php b/includes/api/legacy/v2/class-wc-api-orders.php index 8dc06a54d3a..b47830a38bc 100644 --- a/includes/api/legacy/v2/class-wc-api-orders.php +++ b/includes/api/legacy/v2/class-wc-api-orders.php @@ -151,8 +151,6 @@ class WC_API_Orders extends WC_API_Resource { // Get the decimal precession $dp = ( isset( $filter['dp'] ) ? intval( $filter['dp'] ) : 2 ); $order = wc_get_order( $id ); - $order_post = get_post( $id ); - $order_data = array( 'id' => $order->get_id(), 'order_number' => $order->get_order_number(), diff --git a/includes/api/legacy/v3/class-wc-api-orders.php b/includes/api/legacy/v3/class-wc-api-orders.php index 498be287f41..b89ffb87826 100644 --- a/includes/api/legacy/v3/class-wc-api-orders.php +++ b/includes/api/legacy/v3/class-wc-api-orders.php @@ -149,10 +149,9 @@ class WC_API_Orders extends WC_API_Resource { } // Get the decimal precession. - $dp = ( isset( $filter['dp'] ) ? intval( $filter['dp'] ) : 2 ); - $order = wc_get_order( $id ); - $order_post = get_post( $id ); - $expand = array(); + $dp = ( isset( $filter['dp'] ) ? intval( $filter['dp'] ) : 2 ); + $order = wc_get_order( $id ); + $expand = array(); if ( ! empty( $filter['expand'] ) ) { $expand = explode( ',', $filter['expand'] );