Revert is_vat_exempt changes in item classes

This commit is contained in:
Mike Jolley 2017-10-31 13:36:57 +00:00
parent bc7484f473
commit 80b16adb0a
3 changed files with 7 additions and 10 deletions

View File

@ -66,18 +66,17 @@ class WC_Order_Item_Fee extends WC_Order_Item {
*
* @since 3.2.0
* @param array $calculate_tax_for Location data to get taxes for. Required.
* @param bool $is_vat_exempt Indicates if the order should not have VAT applied to it.
* @return bool True if taxes were calculated.
*/
public function calculate_taxes( $calculate_tax_for = array(), $is_vat_exempt = false ) {
public function calculate_taxes( $calculate_tax_for = array() ) {
if ( ! isset( $calculate_tax_for['country'], $calculate_tax_for['state'], $calculate_tax_for['postcode'], $calculate_tax_for['city'] ) ) {
return false;
}
// Use regular calculation unless the fee is negative.
if ( 0 <= $this->get_total() ) {
return parent::calculate_taxes( $calculate_tax_for, $is_vat_exempt );
return parent::calculate_taxes( $calculate_tax_for );
}
if ( ! $is_vat_exempt && wc_tax_enabled() && ( $order = $this->get_order() ) ) {
if ( wc_tax_enabled() && ( $order = $this->get_order() ) ) {
// Apportion taxes to order items, shipping, and fees.
$order = $this->get_order();
$tax_class_costs = $this->get_tax_class_costs( $order );

View File

@ -33,14 +33,13 @@ class WC_Order_Item_Shipping extends WC_Order_Item {
*
* @since 3.2.0
* @param array $calculate_tax_for Location data to get taxes for. Required.
* @param bool $is_vat_exempt Indicates if the order should not have VAT applied to it.
* @return bool True if taxes were calculated.
*/
public function calculate_taxes( $calculate_tax_for = array(), $is_vat_exempt = false ) {
public function calculate_taxes( $calculate_tax_for = array() ) {
if ( ! isset( $calculate_tax_for['country'], $calculate_tax_for['state'], $calculate_tax_for['postcode'], $calculate_tax_for['city'], $calculate_tax_for['tax_class'] ) ) {
return false;
}
if ( ! $is_vat_exempt && wc_tax_enabled() ) {
if ( wc_tax_enabled() ) {
$tax_rates = WC_Tax::find_shipping_rates( $calculate_tax_for );
$taxes = WC_Tax::calc_tax( $this->get_total(), $tax_rates, false );
$this->set_taxes( array( 'total' => $taxes ) );

View File

@ -203,14 +203,13 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
*
* @since 3.2.0
* @param array $calculate_tax_for Location data to get taxes for. Required.
* @param bool $is_vat_exempt Indicates if the order should not have VAT applied to it.
* @return bool True if taxes were calculated.
*/
public function calculate_taxes( $calculate_tax_for = array(), $is_vat_exempt = false ) {
public function calculate_taxes( $calculate_tax_for = array() ) {
if ( ! isset( $calculate_tax_for['country'], $calculate_tax_for['state'], $calculate_tax_for['postcode'], $calculate_tax_for['city'] ) ) {
return false;
}
if ( ! $is_vat_exempt && '0' !== $this->get_tax_class() && 'taxable' === $this->get_tax_status() && wc_tax_enabled() ) {
if ( '0' !== $this->get_tax_class() && 'taxable' === $this->get_tax_status() && wc_tax_enabled() ) {
$calculate_tax_for['tax_class'] = $this->get_tax_class();
$tax_rates = WC_Tax::find_rates( $calculate_tax_for );
$taxes = WC_Tax::calc_tax( $this->get_total(), $tax_rates, false );