Catch Product # titles and remove error logs

This commit is contained in:
Justin Shreve 2017-01-25 10:37:48 -08:00
parent f344143b63
commit 9889efec75
1 changed files with 3 additions and 7 deletions

View File

@ -70,11 +70,8 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
$this->read_product_data( $product ); $this->read_product_data( $product );
$product->set_attributes( wc_get_product_variation_attributes( $product->get_id() ) ); $product->set_attributes( wc_get_product_variation_attributes( $product->get_id() ) );
error_log( print_r( $product_name, 1 ) ); // Clean up old variation titles.
if ( __( 'Variation #', 'woocommerce' ) === substr( $product_name, 0, 11 ) || ( 'Product #' . $product->get_parent_id() . ' Variation' ) === $product_name ) {
if ( __( 'Variation #', 'woocommerce' ) === substr( $product_name, 0, 11 ) ) {
error_log( 'clean up' );
error_log( print_r( $product_name, 1 ) );
$parent_data = $product->get_parent_data(); $parent_data = $product->get_parent_data();
$new_title = $parent_data['name'] . ' – ' . wc_get_formatted_variation( $product, true, false ); $new_title = $parent_data['name'] . ' – ' . wc_get_formatted_variation( $product, true, false );
$product->set_name( $new_title ); $product->set_name( $new_title );
@ -82,7 +79,6 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
'ID' => $product->get_id(), 'ID' => $product->get_id(),
'post_title' => $new_title, 'post_title' => $new_title,
) ); ) );
error_log( print_r( $new_title, 1 ) );
} }
// Set object_read true once all data is read. // Set object_read true once all data is read.