get product_id using wc_get_product_id_by_sku

This commit is contained in:
Guillermo Gette 2015-03-18 23:11:28 +11:00
parent 122cca701b
commit 49f84a7bc6
1 changed files with 2 additions and 1 deletions

View File

@ -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