Code Duplication    Length = 3-3 lines in 2 locations

includes/cli/class-wc-cli-product.php 1 location

@@ 1294-1296 (lines=3) @@
1291
		}
1292
1293
		// Product parent ID for groups
1294
		if ( isset( $data['parent_id'] ) ) {
1295
			wp_update_post( array( 'ID' => $product_id, 'post_parent' => absint( $data['parent_id'] ) ) );
1296
		}
1297
1298
		// Update parent if grouped so price sorting works and stays in sync with the cheapest child
1299
		$_product = wc_get_product( $product_id );

includes/api/class-wc-rest-products-controller.php 1 location

@@ 1094-1096 (lines=3) @@
1091
1092
		// Product parent ID for groups.
1093
		$parent_id = 0;
1094
		if ( isset( $request['parent_id'] ) ) {
1095
			$parent_id = wp_update_post( array( 'ID' => $product->id, 'post_parent' => absint( $request['parent_id'] ) ) );
1096
		}
1097
1098
		// Update parent if grouped so price sorting works and stays in sync with the cheapest child.
1099
		if ( $parent_id > 0 || 'grouped' === $product_type ) {