skip to Main Content

I’m new to PHP and also new to WooCommerce. I would like to remove the meta in red, but it is actually a span in the email.

enter image description here
enter image description here

I’ve tried adding this code to modify email CSS, but is there a way to just target the concerned text?

add_filter( 'woocommerce_email_styles', 'add_css_to_emails', 10, 2 );
function add_css_to_emails( $css, $email ) {
$css .= '
    td:first-child{font-size: 0px }
';
return $css;
}

enter image description here

enter image description here

    add_filter( 'woocommerce_email_styles', 'add_css_to_emails', 10, 2 );
function add_css_to_emails( $css, $email ) {
$css .= '
    td:first-child span{font-size: 0px }
';
return $css;
}

2

Answers


  1. WooCommerce uses template files to generate customer emails. You’ll need to find the template file responsible for the specific email you want to customize. In this case, it looks like you want to customize the order details table in the email.

    Pluginswoocommercetemplatesemailsemail-order-details.php file
    

    Please check above file

    Once you’ve located the template file, copy it to your theme’s folder or child theme’s folder. This ensures that your changes won’t be overridden when WooCommerce or your theme is updated.

    I hope it will help you someone..!

    Login or Signup to reply.
  2. Add the below code snippet in your active theme’s functions.php in order to hide order item meta within email template.

    add_action( 'woocommerce_email_header', function() {
            add_filter( 'woocommerce_display_item_meta', '__return_empty_string' );
    } );
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search