diff --git a/includes/class-wc-discounts.php b/includes/class-wc-discounts.php index 8b39a8d992e..6f8502612a4 100644 --- a/includes/class-wc-discounts.php +++ b/includes/class-wc-discounts.php @@ -665,10 +665,6 @@ class WC_Discounts { protected function validate_coupon_minimum_amount( $coupon ) { $subtotal = wc_remove_number_precision( $this->get_object_subtotal() ); - if ( is_a( $this->object, 'WC_Order' ) && $this->object->get_prices_include_tax() ) { - $subtotal += round( $this->object->get_total_tax(), wc_get_price_decimals() ); - } - if ( $coupon->get_minimum_amount() > 0 && apply_filters( 'woocommerce_coupon_validate_minimum_amount', $coupon->get_minimum_amount() > $subtotal, $coupon, $subtotal ) ) { /* translators: %s: coupon minimum amount */ throw new Exception( sprintf( __( 'The minimum spend for this coupon is %s.', 'woocommerce' ), wc_price( $coupon->get_minimum_amount() ) ), 108 ); @@ -688,10 +684,6 @@ class WC_Discounts { protected function validate_coupon_maximum_amount( $coupon ) { $subtotal = wc_remove_number_precision( $this->get_object_subtotal() ); - if ( is_a( $this->object, 'WC_Order' ) && $this->object->get_prices_include_tax() ) { - $subtotal += round( $this->object->get_total_tax(), wc_get_price_decimals() ); - } - if ( $coupon->get_maximum_amount() > 0 && apply_filters( 'woocommerce_coupon_validate_maximum_amount', $coupon->get_maximum_amount() < $subtotal, $coupon ) ) { /* translators: %s: coupon maximum amount */ throw new Exception( sprintf( __( 'The maximum spend for this coupon is %s.', 'woocommerce' ), wc_price( $coupon->get_maximum_amount() ) ), 112 ); @@ -916,7 +908,8 @@ class WC_Discounts { if ( is_a( $this->object, 'WC_Cart' ) ) { return wc_add_number_precision( $this->object->get_displayed_subtotal() ); } elseif ( is_a( $this->object, 'WC_Order' ) ) { - return wc_add_number_precision( $this->object->get_subtotal() ); + $subtotal = wc_add_number_precision( $this->object->get_subtotal() ); + return $this->object->get_prices_include_tax() ? $subtotal + round( $this->object->get_total_tax(), wc_get_price_decimals() ) : $subtotal; } else { return array_sum( wp_list_pluck( $this->items, 'price' ) ); }