WC_Product_Variable_Data_Store_CPT::taxes_influence_priceprotectedWC 10.4.0

Check if the prices for a product will be different with or without taxes.

Method of the class: WC_Product_Variable_Data_Store_CPT{}

No Hooks.

Returns

true|false. True if the prices will be different with or without taxes.

Usage

// protected - for code of main (parent) or child class
$result = $this->taxes_influence_price( $product ): bool;
$product(WC_Product) (required)
Product to check.

Changelog

Since 10.4.0 Introduced.

WC_Product_Variable_Data_Store_CPT::taxes_influence_price() code WC 10.9.4

protected function taxes_influence_price( $product ): bool {
	if ( ! $product->is_taxable() ) {
		return false;
	}

	if ( empty( WC_Tax::get_rates( $product->get_tax_class() ) ) ) {
		return false;
	}

	// Taxes influence the price regardless of VAT exempt status. Even when a
	// customer is VAT exempt, the displayed prices differ from non-exempt
	// prices, so they need separate cache entries and the opposite_price_hash
	// optimization should not apply. Returning false here was causing cached
	// non-exempt prices to be served to VAT exempt customers.
	// See: https://github.com/woocommerce/woocommerce/issues/63716

	return true;
}