0

I'm building a site in wordpress and when I goto cart this keeps popping up

"(estimated for Australia)" right after TAX then gives the value of the tax on the item/s.

I checked out another question and answer on here for the same thing however they had different code to the code I have. I tried a few different things but can't figure it out.

This is the code when I inspect it on google chrome for the cart.

<tr class="tax-total">
    <th>Tax <small>(estimated for Australia)</small></th>
    <td data-title="Tax">
       <span class="woocommerce-Price-amount amount">
       <span class="woocommerce-Price-currencySymbol">$</span>109.80</span> 
    </td>
</tr>

Can someone figure out a filter fix for me?

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
Alisha84
  • 13
  • 1
  • 3

2 Answers2

1

You can do it by editing WooCommerce cart template file of your theme. I guess that is hardcoded there in cart.php.

Or if you want easier solution, just hide it with CSS.

This code hides "(estimated for {country})" part:

.tax-total th small {display:none!important}

This one hides

.tax-total {display:none!important}
Elvin Haci
  • 3,503
  • 1
  • 17
  • 22
1

The responsible function for that behavior is wc_cart_totals_order_total_html() … But hopefully you can change that using the following code hooked function:

add_filter( 'woocommerce_cart_totals_order_total_html', 'filtering_cart_totals_order_total_html', 20, 1 );
function filtering_cart_totals_order_total_html( $value ){
    $value = '<strong>' . WC()->cart->get_total() . '</strong> ';

        // If prices are tax inclusive, show taxes here.
    if ( wc_tax_enabled() && WC()->cart->display_prices_including_tax() ) {
        $tax_string_array = array();
        $cart_tax_totals  = WC()->cart->get_tax_totals();

        if ( get_option( 'woocommerce_tax_total_display' ) == 'itemized' ) {
            foreach ( $cart_tax_totals as $code => $tax ) {
                $tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label );
            }
        } elseif ( ! empty( $cart_tax_totals ) ) {
            $tax_string_array[] = sprintf( '%s %s', wc_price( WC()->cart->get_taxes_total( true, true ) ), WC()->countries->tax_or_vat() );
        }

        if ( ! empty( $tax_string_array ) ) {
            $value .= '<small class="includes_tax">' . sprintf( __( '(includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) ) . '</small>';
        }
    }
    return $value;
}

Code goes in function.php file of your active child theme (or active theme). Tested and works.

You will get:

enter image description here

Instead of:

enter image description here

This is an update for Woocommerce 3.2+ slight different, based on this answer: Remove "estimated for {country}" text after tax amount in Woocommerce checkout page

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399