I am using this to display a custom text for customers from specific countries on the cart and checkout page:
add_filter( 'woocommerce_cart_totals_order_total_html', 'custom_total_message_html', 10, 1 );
function custom_total_message_html( $value ) {
if( in_array( WC()->customer->get_shipping_country(), array('US', 'CA') ) ) {
$value .= '<small>' . __('My text.', 'woocommerce') . '</small>';
}
return $value;
}
This does however NOT add the custom text after the order totals in the plain order emails that Woocommerce is sending. I know there is a filter woocommerce_get_formatted_order_total
but I cannot seem to get a working function with this. How can I modify my function above to also display the custom text after the price in the plain order emails?