WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

Automattic\WooCommerce\Blocks\StoreApi\Utilities

ProductQuery::add_query_clauses() public WC 1.0

Add in conditional search filters for products.

{} Это метод класса: ProductQuery{}

Хуков нет.

Возвращает

Массив.

Использование

$ProductQuery = new ProductQuery();
$ProductQuery->add_query_clauses( $args, $wp_query );
$args(массив) (обязательный)
Query args.
$wp_query(\WC_Query) (обязательный)
WC_Query object.

Код ProductQuery::add_query_clauses() WC 4.7.1

<?php
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'] .= $wpdb->prepare( ' AND wc_product_meta_lookup.stock_status = %s ', $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;
}