Merge pull request #15208 from woocommerce/fix/15203

Missing variable in legacy API
This commit is contained in:
Claudiu Lodromanean 2017-05-22 13:10:28 -07:00 committed by GitHub
commit 58189cb4b5
1 changed files with 2 additions and 2 deletions

View File

@ -243,8 +243,8 @@ class WC_API_Orders extends WC_API_Resource {
'meta' => array_values( $item_meta ),
);
if ( in_array( 'products', $expand ) ) {
$_product_data = WC()->api->WC_API_Products->get_product( $product_id );
if ( in_array( 'products', $expand ) && is_object( $product ) ) {
$_product_data = WC()->api->WC_API_Products->get_product( $product->get_id() );
if ( isset( $_product_data['product'] ) ) {
$line_item['product_data'] = $_product_data['product'];