Code Duplication    Length = 9-9 lines in 2 locations

includes/wc-term-functions.php 2 locations

@@ 607-615 (lines=9) @@
604
605
	$product_terms = get_the_terms( $product_id, 'product_cat' );
606
607
	if ( $product_terms ) {
608
		$product_cats = array();
609
610
		foreach ( $product_terms as $term ) {
611
			$product_cats[ $term->term_id ] = $term->parent;
612
		}
613
614
		_wc_term_recount( $product_cats, get_taxonomy( 'product_cat' ), false, false );
615
	}
616
617
	$product_terms = get_the_terms( $product_id, 'product_tag' );
618
@@ 619-627 (lines=9) @@
616
617
	$product_terms = get_the_terms( $product_id, 'product_tag' );
618
619
	if ( $product_terms ) {
620
		$product_tags = array();
621
622
		foreach ( $product_terms as $term ) {
623
			$product_tags[ $term->term_id ] = $term->parent;
624
		}
625
626
		_wc_term_recount( $product_tags, get_taxonomy( 'product_tag' ), false, false );
627
	}
628
}
629
add_action( 'woocommerce_product_set_stock_status', 'wc_recount_after_stock_change' );
630