Custom Styles for WooCommerce Emails
Adds your own CSS to every WooCommerce email, for example to change fonts, button colours or table borders, without overriding email templates.
Opens WPIDE on
Code
$wpide_email_css = '
#template_header h1 { font-weight: 600; letter-spacing: -0.5px; }
#body_content table td, #body_content table th { border-color: #e5e5e5 !important; }
#body_content a { color: #2563eb; }
.td { padding: 10px 12px !important; }
#template_footer #credit { font-size: 12px; color: #6b7280; }
';
add_filter( 'woocommerce_email_styles', function ( $css ) use ( $wpide_email_css ) {
return $css . "\n" . wp_strip_all_tags( $wpide_email_css );
}, 20 );
Notes
WooCommerce inlines this CSS into each email, so keep to simple selectors that email apps support.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.