From 49f84a7bc6495ab11f66a50961ac626e016290fb Mon Sep 17 00:00:00 2001 From: Guillermo Gette Date: Wed, 18 Mar 2015 23:11:28 +1100 Subject: [PATCH] get product_id using wc_get_product_id_by_sku --- includes/api/class-wc-api-orders.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/api/class-wc-api-orders.php b/includes/api/class-wc-api-orders.php index f3f25d8039a..fcff4e65f11 100644 --- a/includes/api/class-wc-api-orders.php +++ b/includes/api/class-wc-api-orders.php @@ -880,7 +880,8 @@ class WC_API_Orders extends WC_API_Resource { if ( isset( $item['product_id'] ) ) { $product = wc_get_product( $item['product_id'] ); } elseif ( isset( $item['sku'] ) ) { - $product = wc_get_product_by_sku( $item['sku'] ); + $product_id = wc_get_product_id_by_sku( $item['sku'] ); + $product = wc_get_product( $product_id ); } // must be a valid WC_Product