Check if product is taxable.
This commit is contained in:
parent
4e4c0bc5fa
commit
1098d49526
|
@ -1890,12 +1890,12 @@ class WC_Cart {
|
||||||
$discount_amount = min( $price, $discount_amount );
|
$discount_amount = min( $price, $discount_amount );
|
||||||
$price = max( $price - $discount_amount, 0 );
|
$price = max( $price - $discount_amount, 0 );
|
||||||
|
|
||||||
// Store the totals for DISPLAY in the cart
|
// Store the totals for DISPLAY in the cart.
|
||||||
if ( $add_totals ) {
|
if ( $add_totals ) {
|
||||||
$total_discount = $discount_amount * $values['quantity'];
|
$total_discount = $discount_amount * $values['quantity'];
|
||||||
$total_discount_tax = 0;
|
$total_discount_tax = 0;
|
||||||
|
|
||||||
if ( wc_tax_enabled() ) {
|
if ( wc_tax_enabled() && $product->is_taxable() ) {
|
||||||
$tax_rates = WC_Tax::get_rates( $product->get_tax_class() );
|
$tax_rates = WC_Tax::get_rates( $product->get_tax_class() );
|
||||||
$taxes = WC_Tax::calc_tax( $discount_amount, $tax_rates, $this->prices_include_tax );
|
$taxes = WC_Tax::calc_tax( $discount_amount, $tax_rates, $this->prices_include_tax );
|
||||||
$total_discount_tax = WC_Tax::get_tax_total( $taxes ) * $values['quantity'];
|
$total_discount_tax = WC_Tax::get_tax_total( $taxes ) * $values['quantity'];
|
||||||
|
|
Loading…
Reference in New Issue