Automattic\WooCommerce\Blocks\BlockTypes\ProductCollection

QueryBuilder::should_adjust_price_range_for_taxesprivateWC 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.

Method of the class: QueryBuilder{}

No Hooks.

Returns

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

Usage

// private - for code of main (parent) class only
$result = $this->should_adjust_price_range_for_taxes();

QueryBuilder::should_adjust_price_range_for_taxes() code WC 10.5.0

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;
}