[2.3] get_discounted_price needs to check if taxes are enabled
Closes #8267
This commit is contained in:
parent
b433f5e2ce
commit
71673684fb
|
@ -1832,14 +1832,15 @@ class WC_Cart {
|
|||
$total_discount = $discount_amount * $values['quantity'];
|
||||
$total_discount_tax = 0;
|
||||
|
||||
// Calc discounted tax
|
||||
$tax_rates = WC_Tax::get_rates( $product->get_tax_class() );
|
||||
$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 = $this->prices_include_tax ? $total_discount - $total_discount_tax : $total_discount;
|
||||
if ( wc_tax_enabled() ) {
|
||||
$tax_rates = WC_Tax::get_rates( $product->get_tax_class() );
|
||||
$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 = $this->prices_include_tax ? $total_discount - $total_discount_tax : $total_discount;
|
||||
$this->discount_cart_tax += $total_discount_tax;
|
||||
}
|
||||
|
||||
$this->discount_cart += $total_discount;
|
||||
$this->discount_cart_tax += $total_discount_tax;
|
||||
$this->increase_coupon_discount_amount( $code, $total_discount, $total_discount_tax );
|
||||
$this->increase_coupon_applied_count( $code, $values['quantity'] );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue