WC_Product_Variable_Data_Store_CPT::taxes_influence_price │ protected │ WC 10.4.0

Deprecated since since 11.3.0 after read_price_data method optimization renders this method obsolete. It is no longer supported and may be removed in future releases. It is recommended to replace this function with the same one.

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

Method of the class: WC_Product_Variable_Data_Store_CPT{}

Returns

bool. 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.
Deprecated Since 11.3.0 after read_price_data method optimization renders this method obsolete

WC_Product_Variable_Data_Store_CPT::taxes_influence_price() code WC 11.3.0

protected function taxes_influence_price( $product ): bool {
	wc_deprecated_function( __METHOD__, '11.3.0' );

	if ( ! $product->is_taxable() ) {
		$taxes_influence_price = false;
	} elseif ( empty( WC_Tax::get_rates( $product->get_tax_class() ) ) ) {
		$taxes_influence_price = false;
	} else {
		// 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 hash_raw
		// optimization should not apply. Returning false here was causing cached
		// non-exempt prices to be served to VAT exempt customers.
		$taxes_influence_price = true;
	}

	/**
	 * Filters whether taxes influence the displayed price of a variable product.
	 *
	 * Return `true` from this filter to force separate cache entries for the two
	 * variants. This is needed when an extension produces displayed prices that
	 * differ from raw prices independently of the standard tax calculation, for
	 * example when computing per-country prices for locations that have no
	 * configured tax rates.
	 *
	 * @param bool       $taxes_influence_price Default decision based on product taxability and configured tax rates.
	 * @param WC_Product $product               The variable product being evaluated.
	 *
	 * @since 10.9.0
	 * @deprecated since 11.3.0 after read_price_data method optimization renders this filter obsolete
	 */
	return (bool) apply_filters_deprecated( 'woocommerce_variable_product_taxes_influence_price', array( $taxes_influence_price, $product ), '11.3.0' );
}