Automattic\WooCommerce\Blocks\BlockTypes

ProductCollection::should_adjust_price_range_for_taxes()privateWC 1.0

Determines if price filters need adjustment based on the tax display settings.

This function checks if there's a discrepancy between how prices are stored in the database and how they are displayed to the user, specifically with respect to tax inclusion or exclusion. It returns true if an adjustment is needed, indicating that the price filters should account for this discrepancy to display accurate prices.

Метод класса: ProductCollection{}

Хуков нет.

Возвращает

true|false. True if the price filters need to be adjusted for tax display settings, false otherwise.

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

// private - только в коде основоного (родительского) класса
$result = $this->should_adjust_price_range_for_taxes();

Код ProductCollection::should_adjust_price_range_for_taxes() WC 9.4.2

private function should_adjust_price_range_for_taxes() {
	$display_setting      = get_option( 'woocommerce_tax_display_shop' ); // Tax display setting ('incl' or 'excl').
	$price_storage_method = wc_prices_include_tax() ? 'incl' : 'excl';

	return $display_setting !== $price_storage_method;
}