From 8f43d9cf8bc715ee99012ff157d1dc7640f5075a Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Tue, 5 Feb 2013 11:28:28 +0000 Subject: [PATCH] If a product type does not exist, default to SIMPLE Closes #2360. --- classes/class-wc-product-factory.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/classes/class-wc-product-factory.php b/classes/class-wc-product-factory.php index d4637765bce..420c4c9db01 100644 --- a/classes/class-wc-product-factory.php +++ b/classes/class-wc-product-factory.php @@ -54,10 +54,9 @@ class WC_Product_Factory { // Filter classname so that the class can be overridden if extended. $classname = apply_filters( 'woocommerce_product_class', $classname, $product_type, $post_type, $product_id ); - if ( $classname && class_exists( $classname ) ) { - return new $classname( $the_product, $args ); - } + if ( ! class_exists( $classname ) ) + $classname = 'WC_Product_Simple'; - return false; + return new $classname( $the_product, $args ); } } \ No newline at end of file