Change default WordPress auto-draft title for product

This helps handle variations title while syncing variations.

Using a translatable string can led to errors, like a auto-draft started
by an user with WP admin set up as pt_BR and published by an user in
en_GB.
This commit is contained in:
Claudio Sanches 2017-03-15 15:12:49 -03:00
parent dfd2d7387c
commit c856abba3e
2 changed files with 4 additions and 1 deletions

View File

@ -254,7 +254,10 @@ class WC_Post_Data {
$data['post_parent'] = 0;
break;
}
} elseif ( 'product' === $data['post_type'] && 'auto-draft' === $data['post_status'] ) {
$data['post_title'] = 'AUTO-DRAFT';
}
return $data;
}

View File

@ -313,7 +313,7 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple
WHERE post_type = 'product_variation'
AND post_parent = %d
",
$previous_name ? $previous_name : __( 'Auto Draft' ),
$previous_name ? $previous_name : 'AUTO-DRAFT',
$new_name,
$product->get_id()
) );