diff --git a/includes/class-wc-cart.php b/includes/class-wc-cart.php index e7e9a7b352a..5ad86fd79d7 100644 --- a/includes/class-wc-cart.php +++ b/includes/class-wc-cart.php @@ -1652,11 +1652,17 @@ class WC_Cart { */ public function remove_taxes() { $this->shipping_tax_total = $this->tax_total = 0; - $this->taxes = $this->shipping_taxes = array(); $this->subtotal = $this->subtotal_ex_tax; foreach ( $this->cart_contents as $cart_item_key => $item ) $this->cart_contents[ $cart_item_key ]['line_subtotal_tax'] = $this->cart_contents[ $cart_item_key ]['line_tax'] = 0; + + // If true, zero rate is applied so '0' tax is displayed on the frontend rather than nothing. + if ( apply_filters( 'woocommerce_cart_remove_taxes_apply_zero_rate', true ) ) { + $this->taxes = $this->shipping_taxes = array( apply_filters( 'woocommerce_cart_remove_taxes_zero_rate_id', 'zero-rated' ) => 0 ); + } else { + $this->taxes = $this->shipping_taxes = array(); + } } /** diff --git a/includes/class-wc-tax.php b/includes/class-wc-tax.php index 090e68dd4db..83e5ce51403 100644 --- a/includes/class-wc-tax.php +++ b/includes/class-wc-tax.php @@ -548,8 +548,14 @@ class WC_Tax { * @return string */ public function get_rate_label( $key ) { - global $wpdb; - return apply_filters( 'woocommerce_rate_label', $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_name FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_id = %s", $key ) ), $key, $this ); + global $wpdb, $woocommerce; + + $rate_name = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_name FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_id = %s", $key ) ); + + if ( ! $rate_name ) + $rate_name = $woocommerce->countries->tax_or_vat(); + + return apply_filters( 'woocommerce_rate_label', $rate_name, $key, $this ); } /**