Skip to content

Instantly share code, notes, and snippets.

@rynaldos-zz
Created January 17, 2019 10:28
Show Gist options
  • Save rynaldos-zz/ee4f2405a7c602af1708e013eb978dca to your computer and use it in GitHub Desktop.
Save rynaldos-zz/ee4f2405a7c602af1708e013eb978dca to your computer and use it in GitHub Desktop.
Show zero rate tax line in checkout when exempt
add_filter( 'woocommerce_cart_tax_totals', 'show_zero_rate_taxes' );
function show_zero_rate_taxes( $tax_totals ) {
if ( empty( $tax_totals ) && WC()->customer->is_vat_exempt() ) {
$tax_totals['zero-rated'] = (object) array(
'label' => 'Zero Rated Tax',
'amount' => 0,
'formatted_amount' => wc_price( 0 ),
'name' => 'Zero Rated Tax',
'is_compound' => false
);
}
return $tax_totals;
}
@beayeric
Copy link

Hi!! thanks very much for the code.
Is not working for me.
Really appreciate your help.
Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment