get_product in product factory should return passed in object if its a product already

Fixes #6726
This commit is contained in:
Mike Jolley 2014-11-11 16:24:22 +00:00
parent 9e53b3fb33
commit a076c5a69d
1 changed files with 5 additions and 2 deletions

View File

@ -27,12 +27,15 @@ class WC_Product_Factory {
$the_product = $post;
} elseif ( is_numeric( $the_product ) ) {
$the_product = get_post( $the_product );
} elseif ( $the_product instanceof WC_Product ) {
return $the_product;
}
if ( ! $the_product )
if ( ! $the_product ) {
return false;
}
if ( is_object ( $the_product ) ) {
if ( is_object( $the_product ) ) {
$product_id = absint( $the_product->ID );
$post_type = $the_product->post_type;
}