Make wc_get_product() return false if the specified post is not a product

This commit is contained in:
Matt Isenhower 2016-03-31 17:51:01 -07:00
parent cb0f703086
commit 7561f772d9
1 changed files with 4 additions and 0 deletions

View File

@ -33,6 +33,10 @@ class WC_Product_Factory {
$classname = $this->get_product_class( $the_product, $args ); $classname = $this->get_product_class( $the_product, $args );
if ( ! $classname ) {
return false;
}
if ( ! class_exists( $classname ) ) { if ( ! class_exists( $classname ) ) {
$classname = 'WC_Product_Simple'; $classname = 'WC_Product_Simple';
} }