From 78fe84049957af12431a2c917af657f6ae6469c7 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 22 Jan 2015 19:20:05 -0200 Subject: [PATCH] [API] Fixed the properties for save downloadable files in products endpoint #5942 --- includes/api/class-wc-api-products.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/api/class-wc-api-products.php b/includes/api/class-wc-api-products.php index a379234c924..79d5f781c2e 100644 --- a/includes/api/class-wc-api-products.php +++ b/includes/api/class-wc-api-products.php @@ -1492,12 +1492,16 @@ class WC_API_Products extends WC_API_Resource { // File paths will be stored in an array keyed off md5(file path) foreach ( $downloads as $key => $file ) { - if ( ! isset( $file['url'] ) ) { + if ( isset( $file['url'] ) ) { + $file['file'] = $file['url']; + } + + if ( ! isset( $file['file'] ) ) { continue; } $file_name = isset( $file['name'] ) ? wc_clean( $file['name'] ) : ''; - $file_url = wc_clean( $file['url'] ); + $file_url = wc_clean( $file['file'] ); $files[ md5( $file_url ) ] = array( 'name' => $file_name,