skip to Main Content

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


  1. 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>
    
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search