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

Automattic\WooCommerce\Blocks\StoreApi\Utilities

ProductQuery::get_price_filter_query_for_displayed_taxes() protected WC 1.0

Get query for price filters when dealing with displayed taxes.

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

Хуков нет.

Возвращает

Строку. Constructed query.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_price_filter_query_for_displayed_taxes( $price_filter, $column, $operator );
$price_filter(float) (обязательный)
Price filter to apply.
$column(строка)
Price being filtered (min or max).
По умолчанию: 'min_price'
$operator(строка)
Comparison operator for column.
По умолчанию: '>='

Код ProductQuery::get_price_filter_query_for_displayed_taxes() WC 4.7.1

<?php
protected function get_price_filter_query_for_displayed_taxes( $price_filter, $column = 'min_price', $operator = '>=' ) {
	global $wpdb;

	// Select only used tax classes to avoid unwanted calculations.
	$product_tax_classes = $wpdb->get_col( "SELECT DISTINCT tax_class FROM {$wpdb->wc_product_meta_lookup};" );

	if ( empty( $product_tax_classes ) ) {
		return '';
	}

	$or_queries = [];

	// We need to adjust the filter for each possible tax class and combine the queries into one.
	foreach ( $product_tax_classes as $tax_class ) {
		$adjusted_price_filter = $this->adjust_price_filter_for_tax_class( $price_filter, $tax_class );
		$or_queries[]          = $wpdb->prepare(
			'( wc_product_meta_lookup.tax_class = %s AND wc_product_meta_lookup.`' . esc_sql( $column ) . '` ' . esc_sql( $operator ) . ' %f )',
			$tax_class,
			$adjusted_price_filter
		);
	}

	// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQL.NotPrepared
	return $wpdb->prepare(
		' AND (
			wc_product_meta_lookup.tax_status = "taxable" AND ( 0=1 OR ' . implode( ' OR ', $or_queries ) . ')
			OR ( wc_product_meta_lookup.tax_status != "taxable" AND wc_product_meta_lookup.`' . esc_sql( $column ) . '` ' . esc_sql( $operator ) . ' %f )
		) ',
		$price_filter
	);
	// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQL.NotPrepared
}