Code Duplication    Length = 11-11 lines in 2 locations

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

@@ 707-717 (lines=11) @@
704
		}
705
706
		// Filter by specific sku
707
		if ( ! empty( $args['sku'] ) ) {
708
			if ( ! is_array( $query_args['meta_query'] ) ) {
709
				$query_args['meta_query'] = array();
710
			}
711
712
			$query_args['meta_query'][] = array(
713
				'key'     => '_sku',
714
				'value'   => $args['sku'],
715
				'compare' => '='
716
			);
717
		}
718
719
		return $query_args;
720
	}

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

@@ 294-304 (lines=11) @@
291
			$args['post_status'] = 'any';
292
		}
293
294
		if ( ! empty( $request['customer'] ) ) {
295
			if ( ! empty( $args['meta_query'] ) ) {
296
				$args['meta_query'] = array();
297
			}
298
299
			$args['meta_query'][] = array(
300
				'key'   => '_customer_user',
301
				'value' => $request['customer'],
302
				'type'  => 'NUMERIC',
303
			);
304
		}
305
306
		// Search by product.
307
		if ( ! empty( $request['product'] ) ) {