1

I'm looking for a way to display a price suffix in the WooCommerce emails. Like: ex.VAT Is there a short snippet to do this? enter image description here

2 Answers 2

5

Copy the file found at

wp-content/plugins/woocommerce/templates/emails/email-order-items.php -> wp-content/themes/your-theme/woocommerce/emails/email-order-items.php

into your store’s child theme .

Note that if you customize the parent theme rather than the child theme, any changes will be overwritten with theme updates.

Change code in wp-content/themes/your-theme/woocommerce/emails/email-order-items.php

Before

<td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;">
            <?php echo wp_kses_post( $order->get_formatted_line_subtotal( $item ) ); ?>
</td>

After

<td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;">
            <?php echo wp_kses_post( $order->get_formatted_line_subtotal( $item ) ); ?> ex. VAT
</td>
0

You can make this customization without changing template files, by filtering woocommerce_order_formatted_line_subtotal Like this:

add_filter( 'woocommerce_order_formatted_line_subtotal', 'BN_add_price_suffix_subtotal', 10, 3 );

function BN_add_price_suffix_subtotal( $subtotal ) {
    
    $suffix =' ex. VAT';
    return $subtotal . $suffix;
}

Add this to the functions.php file in your child theme.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.