Term counts only need to be deleted when terms are recounted
This commit is contained in:
parent
af77d8f12c
commit
3e0f6e2511
|
@ -107,8 +107,6 @@ class WC_Admin_Status {
|
|||
|
||||
_wc_term_recount( $product_tags, get_taxonomy( 'product_tag' ), true, false );
|
||||
|
||||
delete_transient( 'wc_term_counts' );
|
||||
|
||||
echo '<div class="updated"><p>' . __( 'Terms successfully recounted', 'woocommerce' ) . '</p></div>';
|
||||
break;
|
||||
case 'clear_sessions' :
|
||||
|
|
|
@ -254,13 +254,13 @@ class WC_Admin_Taxonomies {
|
|||
* @return void
|
||||
*/
|
||||
public function save_category_fields( $term_id, $tt_id, $taxonomy ) {
|
||||
if ( isset( $_POST['display_type'] ) )
|
||||
if ( isset( $_POST['display_type'] ) ) {
|
||||
update_woocommerce_term_meta( $term_id, 'display_type', esc_attr( $_POST['display_type'] ) );
|
||||
}
|
||||
|
||||
if ( isset( $_POST['product_cat_thumbnail_id'] ) )
|
||||
if ( isset( $_POST['product_cat_thumbnail_id'] ) ) {
|
||||
update_woocommerce_term_meta( $term_id, 'thumbnail_id', absint( $_POST['product_cat_thumbnail_id'] ) );
|
||||
|
||||
delete_transient( 'wc_term_counts' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -497,6 +497,8 @@ function _wc_term_recount( $terms, $taxonomy, $callback = true, $terms_are_term_
|
|||
// Update the count
|
||||
update_woocommerce_term_meta( $term_id, 'product_count_' . $taxonomy->name, absint( $count ) );
|
||||
}
|
||||
|
||||
delete_transient( 'wc_term_counts' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -525,8 +527,6 @@ function wc_recount_after_stock_change( $product_id ) {
|
|||
|
||||
_wc_term_recount( $product_tags, get_taxonomy( 'product_tag' ), false, false );
|
||||
}
|
||||
|
||||
delete_transient( 'wc_term_counts' );
|
||||
}
|
||||
add_action( 'woocommerce_product_set_stock_status', 'wc_recount_after_stock_change' );
|
||||
|
||||
|
|
Loading…
Reference in New Issue