Tax exclusive if coupon applied else tax inclusive in items
Finally I have solved it.
First I applied inclusive exlusive filter. Then called woocommerce_calculated_total
with custom condition and achieved my motive.
add_filter( 'woocommerce_calc_tax', 'inc_or_exc',10,3 );// do_action('add_points');add_filter( 'woocommerce_calculated_total', 'custom_calculated_total', 10, 2 );function inc_or_exc( $taxes,$price,$rates ) { // echo "<pre>"; if(!empty(WC()->cart->coupon_discount_amounts)){ return WC_Tax::calc_exclusive_tax( $price, $rates ); }else{ return WC_Tax::calc_inclusive_tax( $price, $rates ); }}function custom_calculated_total( $total, $cart ){ // echo "<pre>"; if(!empty(WC()->cart->coupon_discount_amounts)){ return round( $total + WC()->cart->get_cart_contents_tax(), $cart->dp ); }else{ return round( $total, $cart->dp ); } }