Clear parent transients on variation save

This commit is contained in:
Mike Jolley 2017-03-28 13:51:19 +01:00
parent 4edcdd0fb1
commit 0694312cc9
2 changed files with 5 additions and 2 deletions

View File

@ -155,6 +155,11 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
) );
}
if ( isset( $changes['parent_id'] ) ) {
delete_transient( 'wc_product_children_' . $product->get_parent_id( 'edit' ) );
delete_transient( 'wc_product_children_' . $this->data['parent_id'] );
}
$this->update_post_meta( $product );
$this->update_terms( $product );
$this->update_attributes( $product );

View File

@ -360,7 +360,6 @@ class WC_Tests_Product_Data_Store extends WC_Unit_Test_Case {
$variation->save();
$product = wc_get_product( $product->get_id() );
$product->sync( $product );
$store = new WC_Product_Variable_Data_Store_CPT();
@ -376,7 +375,6 @@ class WC_Tests_Product_Data_Store extends WC_Unit_Test_Case {
$variation->save();
$product = wc_get_product( $product->get_id() );
$product->sync( $product );
$store = new WC_Product_Variable_Data_Store_CPT();