1

I have a store that sells nationally (New Zealand) as well as internationally.

I want a given product to be charged at a consistent price (say, for example NZD$4.95)

For New Zealand orders, I need to be able to highlight the fact that the price NZD$4.95 includes $0.65 GST (for Tax Invoice purposes).

For International orders, I need them to be charged at NZ$4.95, but with no mention of tax.

If I have set up two taxes with the following labels:

  1. NZ GST 15%
  2. International Price Adjustment 15%

Would it be possible to hide all mention of the "International Price Adjustment" from the checkout process?

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
warm__tape
  • 250
  • 4
  • 19

1 Answers1

2

Update: The following code will remove (includes NZD $0.65 International Price Adjustment 15%) tax line for international customers, on cart, checkout, orders and email notifications:

// For Cart and checkout pages
add_filter( 'woocommerce_cart_totals_order_total_html', 'hide_iternational_tax_label', 20, 1 );
function hide_iternational_tax_label( $value ) {

    // For international orders we display only the total, not the taxes line below
    if( 'NZ' != WC()->customer->get_billing_country() )
        return '<strong>' . WC()->cart->get_total() . '</strong> ';

    return $value;
}


// For customer Order received, Order view and email notifications
add_filter( 'woocommerce_get_formatted_order_total', 'hide_iternational_order_tax_label', 20, 4 );
function hide_iternational_order_tax_label(  $formatted_total, $order, $tax_display, $display_refunded ) {

    // For international orders we display only the total, not the taxes line below
    if( 'NZ' != $order->get_billing_country() ){
        $tax_string      = ''; // <=== nulling the tax string
        $order_total     = $order->get_total();
        $formatted_total = wc_price( $order_total, array( 'currency' => $order->get_currency() ) );
        $total_refunded  = $order->get_total_refunded();

        if ( $total_refunded && $display_refunded ) {
            $formatted_total = '<del>' . strip_tags( $formatted_total ) . '</del> <ins>' . wc_price( $order_total - $total_refunded, array( 'currency' => $order->get_currency() ) ) . $tax_string . '</ins>';
        } else {
            $formatted_total .= $tax_string;
        }
    }
    return $formatted_total;
}

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

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
  • thanks- mostly works- this just removes the label though. I need to also remove the _ (includes NZD $0.65 )_ bit as well, to avoid causing customer confusion as to what the .65c is actually for? – warm__tape Mar 27 '18 at 21:34
  • @warm__tape **Updated:** Your question was not really clear regarding this… So know the entire tax line is removed for international customers only… – LoicTheAztec Mar 28 '18 at 02:42