Code Duplication    Length = 10-10 lines in 2 locations

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

@@ 683-692 (lines=10) @@
680
			'meta_query'     => array(),
681
		);
682
683
		if ( ! empty( $args['type'] ) ) {
684
			$types                   = explode( ',', $args['type'] );
685
			$query_args['tax_query'] = array(
686
				array(
687
					'taxonomy' => 'product_type',
688
					'field'    => 'slug',
689
					'terms'    => $types,
690
				),
691
			);
692
		}
693
694
		// Filter products by category
695
		if ( ! empty( $args['category'] ) ) {

includes/class-wc-shortcodes.php 1 location

@@ 825-834 (lines=10) @@
822
	 * @access private
823
	 */
824
	private static function _maybe_add_category_args( $args, $category, $operator ) {
825
		if ( ! empty( $category ) ) {
826
			$args['tax_query'] = array(
827
				array(
828
					'taxonomy' => 'product_cat',
829
					'terms'    => array_map( 'sanitize_title', explode( ',', $category ) ),
830
					'field'    => 'slug',
831
					'operator' => $operator
832
				)
833
			);
834
		}
835
836
		return $args;
837
	}