2
votes

I have been searching but can't find any info on this.

I’d like to "text-align:center" the header text in the Order email sent to admin.

When I inspect the email element in my browser and change text-align:left to "center" the header text moves to where i want.

style='color:#ffffff;display:block;font-family:"Helvetica Neue",Helvetica,Roboto,Arial,sans-serif;font-size:30px;font-weight:300;line-height:150%;margin:0;padding:36px 48px;text-align:left'

regards maximoau

1

1 Answers

0
votes

Previously the mail looked like.

enter image description here

In order to add styling to the headers of the order emails you can use the following code.

add_action('woocommerce_email_header', 'add_css_to_email');
function add_css_to_email() {
echo '
<style type="text/css">
h1 {
  text-align: center !important;
}
</style>
';
}

This code should be coded in functions.php of the theme or your custom plugin. For coding in theme its better to first create and use a child theme, code in its functions.php so that when that theme updates your code wont be overwritten.

After adding this code correctly in theme's/child theme's functions.php the output was -

enter image description here

Using the code in this answer you can give any styling to the header of the email. Note that this styling will even be applied to the mails which are sent on "new customer registration", "Order Complete" and others.