Move changes after set name

This commit is contained in:
Mike Jolley 2017-05-31 16:28:55 +01:00
parent bc3c7f6bbd
commit fc4a9d185e
1 changed files with 2 additions and 1 deletions

View File

@ -143,13 +143,14 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
*/
public function update( &$product ) {
$product->save_meta_data();
$changes = $product->get_changes();
$new_title = $this->generate_product_title( $product );
if ( $product->get_name( 'edit' ) !== $new_title ) {
$product->set_name( $new_title );
}
$changes = $product->get_changes();
// Only update the post when the post data changes.
if ( array_intersect( array( 'name', 'parent_id', 'status', 'menu_order', 'date_created', 'date_modified' ), array_keys( $changes ) ) ) {
$post_data = array(