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?
2
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>
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.
Click here to cancel reply.
2
Answers
Copy the file found at
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
After
You can make this customization without changing template files, by filtering woocommerce_order_formatted_line_subtotal
Like this:
Add this to the functions.php file in your child theme.