From ec6039794afaa0ef50764e307932b00448f8fc72 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 21 Jan 2015 10:38:33 -0200 Subject: [PATCH] [API] Fixed the datetime format for WC_API_Customers::get_customer_downloads() --- includes/api/class-wc-api-customers.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/api/class-wc-api-customers.php b/includes/api/class-wc-api-customers.php index 323b74b2299..4302cdfb1e4 100644 --- a/includes/api/class-wc-api-customers.php +++ b/includes/api/class-wc-api-customers.php @@ -497,10 +497,12 @@ class WC_API_Customers extends WC_API_Resource { return $id; } - $downloads = wc_get_customer_available_downloads( $id ); + $downloads = array(); + $_downloads = wc_get_customer_available_downloads( $id ); - if ( empty( $downloads ) ) { - return array( 'downloads' => array() ); + foreach ( $_downloads as $key => $download ) { + $downloads[ $key ] = $download; + $downloads[ $key ]['access_expires'] = $this->server->format_datetime( $downloads[ $key ]['access_expires'] ); } return array( 'downloads' => apply_filters( 'woocommerce_api_customer_downloads_response', $downloads, $id, $fields, $this->server ) );