To display in cart subtotal (orders and notifications) like "71,540.20€ (includes 11400,00€ VAT)", you can try to use the following:
// Cart and checkout (for display including taxes - not compound)
add_filter('woocommerce_cart_subtotal', 'wc_cart_subtotal_incl_tax_amount_filter', 10, 3 );
function wc_cart_subtotal_incl_tax_amount_filter( $cart_subtotal, $compound, $cart ) {
if ( wc_tax_enabled() && $cart->get_subtotal_tax() > 0 && ! $compound ) {
$subtotal_tax = wc_price( $cart->get_subtotal_tax() );
$cart_subtotal = wc_price( $cart->get_subtotal() + $cart->get_subtotal_tax() );
$tax_label = in_array( WC()->countries->get_base_country(), array_merge( WC()->countries->get_european_union_countries( 'eu_vat' ), array( 'NO' ) ), true ) ? __( 'VAT', 'woocommerce' ) : __( 'Tax', 'woocommerce' );
$cart_subtotal .= sprintf( ' <small>' . esc_html__( '(includes %s %s)', 'woocommerce' ) . '</small>', $subtotal_tax, $tax_label );
}
return $cart_subtotal;
}
// Orders and emails (for display including taxes - not compound)
add_filter('woocommerce_order_subtotal_to_display', 'wc_order_subtotal_incl_tax_amount_filter', 10, 3 );
function wc_order_subtotal_incl_tax_amount_filter( $subtotal, $compound, $order ) {
if ( wc_tax_enabled() && $order->get_total_tax() > 0 && ! $compound ) {
$subtotal_tax = $subtotal = 0; // Initializing
// Loop through order items
foreach ( $order->get_items() as $item ) {
$subtotal += $item->get_subtotal() + $item->get_subtotal_tax();
$subtotal_tax += $item->get_subtotal_tax();
}
$subtotal = wc_price( $subtotal, array( 'currency' => $order->get_currency() ) );
$subtotal_tax = wc_price( $subtotal_tax, array( 'currency' => $order->get_currency() ) );
$tax_label = in_array( WC()->countries->get_base_country(), array_merge( WC()->countries->get_european_union_countries( 'eu_vat' ), array( 'NO' ) ), true ) ? __( 'VAT', 'woocommerce' ) : __( 'Tax', 'woocommerce' );
$subtotal .= sprintf( ' <small>' . esc_html__( '(includes %s %s)', 'woocommerce' ) . '</small>', $subtotal_tax, $tax_label );
}
return $subtotal;
}
Code goes in functions.php file of your active child theme (or active theme). Tested and works.