From 82cdf65c04a27669fe1579a666945a16ea393f98 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 6 Apr 2017 15:56:55 +0100 Subject: [PATCH] if product type field is not posted, we should maintain existing type, not change to simple --- includes/admin/meta-boxes/class-wc-meta-box-product-data.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/meta-boxes/class-wc-meta-box-product-data.php b/includes/admin/meta-boxes/class-wc-meta-box-product-data.php index c8684d6215c..e0d312dcf84 100644 --- a/includes/admin/meta-boxes/class-wc-meta-box-product-data.php +++ b/includes/admin/meta-boxes/class-wc-meta-box-product-data.php @@ -290,8 +290,8 @@ class WC_Meta_Box_Product_Data { */ public static function save( $post_id, $post ) { // Process product type first so we have the correct class to run setters. - $product_type = empty( $_POST['product-type'] ) ? 'simple' : sanitize_title( stripslashes( $_POST['product-type'] ) ); - $classname = WC_Product_Factory::get_product_classname( $post_id, $product_type ); + $product_type = empty( $_POST['product-type'] ) ? WC_Product_Factory::get_product_type( $post_id ) : sanitize_title( stripslashes( $_POST['product-type'] ) ); + $classname = WC_Product_Factory::get_product_classname( $post_id, $product_type ? $product_type : 'simple' ); $product = new $classname( $post_id ); $attributes = self::prepare_attributes(); $errors = $product->set_props( array(