I have added 3 custom fees in my order table but in the emails sent to admin/client, I want to hide one of these custom fee.
See screen shot :
Actually, I added the custom fees with this snippet:
add_action( 'woocommerce_cart_calculate_fees','customfee1' );
function customfee1() {
$soustotalavecliv = (WC()->cart->get_cart_contents_total()+WC()->cart->get_shipping_total());
WC()->cart->add_fee( 'TOTAL', $soustotalavecliv );
}
add_action( 'woocommerce_cart_calculate_fees','customfee2' );
function customfee2() {
$retraitsubt = (WC()->cart->get_cart_contents_total()+WC()->cart->get_shipping_total());
WC()->cart->add_fee( 'A retirer', $retraitsubt*-1 );
}
add_action( 'woocommerce_cart_calculate_fees','customfee3' );
function customfee3() {
$total_minus_100 = (WC()->cart->get_cart_contents_total()+WC()->cart->get_shipping_total()) /2;
WC()->cart->add_fee( 'Acompte versé par CB', $total_minus_100 * -1 );
}
But in all the template emails, I want to hide the "customfee2". I managed to hide this with a CSS code. But the following code works only in the NEW ORDER EMAIL sent to admin and not the other emails.
function ymcode_hide_customfee2_row_with_css()
{
?>
<style>
tfoot tr:nth-child(5) {
display: none !important;
}
</style>
<?php
}
add_action('woocommerce_email_header', 'ymcode_hide_customfee2_row_with_css', 10, 0);
Any advice?
