Flush term cache when saving product and settings closes #25375
This commit is contained in:
parent
ed04d3080a
commit
8b0915c4e0
|
@ -64,6 +64,10 @@ class WC_Settings_Products extends WC_Settings_Page {
|
|||
$settings = $this->get_settings( $current_section );
|
||||
WC_Admin_Settings::save_fields( $settings );
|
||||
|
||||
// Any time we update the product settings, we should flush the term count cache.
|
||||
$tools_controller = new WC_REST_System_Status_Tools_Controller();
|
||||
$tools_controller->execute_tool( 'recount_terms' );
|
||||
|
||||
if ( $current_section ) {
|
||||
do_action( 'woocommerce_update_options_' . $this->id . '_' . $current_section );
|
||||
}
|
||||
|
|
|
@ -272,6 +272,9 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
|
|||
|
||||
$product->apply_changes();
|
||||
|
||||
// Any time we update the product, we should flush the term count cache.
|
||||
$tools_controller = new WC_REST_System_Status_Tools_Controller();
|
||||
$tools_controller->execute_tool( 'recount_terms' );
|
||||
do_action( 'woocommerce_update_product', $product->get_id(), $product );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue