Code Duplication    Length = 19-19 lines in 2 locations

includes/class-wc-ajax.php 2 locations

@@ 2651-2669 (lines=19) @@
2648
	 * @param  array $variations
2649
	 * @param  array $data
2650
	 */
2651
	private static function variation_bulk_action_variable_regular_price( $variations, $data ) {
2652
		if ( ! isset( $data['value'] ) ) {
2653
			return;
2654
		}
2655
2656
		foreach ( $variations as $variation_id ) {
2657
			// Price fields
2658
			$regular_price = wc_clean( $data['value'] );
2659
			$sale_price    = get_post_meta( $variation_id, '_sale_price', true );
2660
2661
			// Date fields
2662
			$date_from = get_post_meta( $variation_id, '_sale_price_dates_from', true );
2663
			$date_to   = get_post_meta( $variation_id, '_sale_price_dates_to', true );
2664
			$date_from = ! empty( $date_from ) ? date( 'Y-m-d', $date_from ) : '';
2665
			$date_to   = ! empty( $date_to ) ? date( 'Y-m-d', $date_to ) : '';
2666
2667
			_wc_save_product_price( $variation_id, $regular_price, $sale_price, $date_from, $date_to );
2668
		}
2669
	}
2670
2671
	/**
2672
	 * Bulk action - Set Sale Prices.
@@ 2677-2695 (lines=19) @@
2674
	 * @param  array $variations
2675
	 * @param  array $data
2676
	 */
2677
	private static function variation_bulk_action_variable_sale_price( $variations, $data ) {
2678
		if ( ! isset( $data['value'] ) ) {
2679
			return;
2680
		}
2681
2682
		foreach ( $variations as $variation_id ) {
2683
			// Price fields
2684
			$regular_price = get_post_meta( $variation_id, '_regular_price', true );
2685
			$sale_price    = wc_clean( $data['value'] );
2686
2687
			// Date fields
2688
			$date_from = get_post_meta( $variation_id, '_sale_price_dates_from', true );
2689
			$date_to   = get_post_meta( $variation_id, '_sale_price_dates_to', true );
2690
			$date_from = ! empty( $date_from ) ? date( 'Y-m-d', $date_from ) : '';
2691
			$date_to   = ! empty( $date_to ) ? date( 'Y-m-d', $date_to ) : '';
2692
2693
			_wc_save_product_price( $variation_id, $regular_price, $sale_price, $date_from, $date_to );
2694
		}
2695
	}
2696
2697
	/**
2698
	 * Bulk action - Set Stock.