WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Utilities

ProductQuery::add_query_clauses() public WC 1.0

Add in conditional search filters for products.

{} It's a method of the class: ProductQuery{}

No Hooks.

Return

Array.

Usage

$ProductQuery = new ProductQuery();
$ProductQuery->add_query_clauses( $args, $wp_query );
$args(array) (required)
Query args.
$wp_query(\WC_Query) (required)
WC_Query object.

Code of ProductQuery::add_query_clauses() WC 5.6.0

public function add_query_clauses( $args, $wp_query ) {
	global $wpdb;

	if ( $wp_query->get( 'search' ) ) {
		$search         = "'%" . $wpdb->esc_like( $wp_query->get( 'search' ) ) . "%'";
		$args['join']   = $this->append_product_sorting_table_join( $args['join'] );
		$args['where'] .= " AND ({$wpdb->posts}.post_title LIKE {$search}";
		$args['where'] .= wc_product_sku_enabled() ? ' OR wc_product_meta_lookup.sku LIKE ' . $search . ')' : ')';
	}

	if ( $wp_query->get( 'sku' ) ) {
		$skus = explode( ',', $wp_query->get( 'sku' ) );
		// Include the current string as a SKU too.
		if ( 1 < count( $skus ) ) {
			$skus[] = $wp_query->get( 'sku' );
		}
		$args['join']   = $this->append_product_sorting_table_join( $args['join'] );
		$args['where'] .= ' AND wc_product_meta_lookup.sku IN ("' . implode( '","', array_map( 'esc_sql', $skus ) ) . '")';
	}

	if ( $wp_query->get( 'stock_status' ) ) {
		$args['join']   = $this->append_product_sorting_table_join( $args['join'] );
		$args['where'] .= ' AND wc_product_meta_lookup.stock_status IN ("' . implode( '","', array_map( 'esc_sql', $wp_query->get( 'stock_status' ) ) ) . '")';
	}

	if ( $wp_query->get( 'min_price' ) || $wp_query->get( 'max_price' ) ) {
		$args = $this->add_price_filter_clauses( $args, $wp_query );
	}

	return $args;
}