I have a problem with this code for add a row in email & thank you page.
add_filter( 'woocommerce_get_order_item_totals', 'bbloomer_add_recurring_row_email', 10, 2 );
function bbloomer_add_recurring_row_email( $total_rows, $myorder_obj ) {
$total_rows['recurr_not'] = array(
'label' => __( 'Rec:', 'woocommerce' ),
'value' => 'blabla'
);
return $total_rows;
}
I have a function to add "Total excl. VAT" row in the cart :
<?php
global $woocommerce;
$frais = 1.01;
echo '<tr class ="totalht">
<th>'. __( 'Total HT', 'woocommerce' ) .'</th>
<td data-title=" '. __( 'Total HT', 'woocommerce' ) .' ">'
. wc_price( ( $woocommerce->cart->cart_contents_total * $frais ) + $woocommerce->cart->shipping_total ) .'<span class="ht-panier">HT</span></td>
</tr>';
?>
It's working good : https://prnt.sc/irglky
But when I modify the first function :
add_filter( 'woocommerce_get_order_item_totals', 'bbloomer_add_recurring_row_email', 5, 2 );
function bbloomer_add_recurring_row_email( $total_rows, $myorder_obj ) {
global $woocommerce;
$frais = 1.01;
$price_excl_vat = wc_price( ( $woocommerce->cart->cart_contents_total * $frais ) + $woocommerce->cart->shipping_total );
$total_rows['recurr_not'] = array(
'label' => __( 'Total HT :', 'woocommerce' ),
'value' => $price_excl_vat
);
return $total_rows;
}
It's not working on the Thank you page
But it's working on email...
Someone can explain me why it's working on email but not in the "Thank you page"?