diff --git a/classes/class-wc-product-factory.php b/classes/class-wc-product-factory.php index 610d3fa15a8..58b1a5c2b1d 100644 --- a/classes/class-wc-product-factory.php +++ b/classes/class-wc-product-factory.php @@ -43,10 +43,10 @@ class WC_Product_Factory { $product_type = 'variation'; } else { $terms = get_the_terms( $product_id, 'product_type' ); - $product_type = ! empty( $terms ) && isset( current( $terms )->name ) ? sanitize_title( current( $terms )->name ) : 'simple'; + $product_type = ! empty( $terms ) && isset( current( $terms )->slug ) ? current( $terms )->slug : 'simple'; } - $classname = 'WC_Product_' . ucfirst( $product_type ); + $classname = 'WC_Product_' . preg_replace( '/(?<=_)(.)/e', "strtoupper( '$1' )", ucfirst( $product_type ) ); } else { $classname = false; $product_type = false;