Merge pull request #8692 from Nils-Fredrik/master

Fix for #8691: Variation without parent will not cause 500.
This commit is contained in:
Claudio Sanches 2015-07-30 21:51:13 -03:00
commit a42b25ec4e
1 changed files with 1 additions and 1 deletions

View File

@ -156,7 +156,7 @@ class WC_API_Products extends WC_API_Resource {
}
// add the parent product data to an individual variation
if ( $product->is_type( 'variation' ) ) {
if ( $product->is_type( 'variation' ) && $product->parent ) {
$product_data['parent'] = $this->get_product_data( $product->parent );
}