yogakeys
October 18, 2018 at 12:21 am
Hi, I have seen many posts on this. I am struggling to get my style sheet to recognize in my emails.
Here is my code:
add_filter( 'gettext', 'mycustom_filter_gettext', 10, 3 );
function ee_modify_html_variation( $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack ) {
if ( $messenger != 'html' ) {
return $variation_path;
}
$new_url = get_stylesheet_directory_uri() . '/ee4-email-style.css';
return $new_url;
}
add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', 'ee_modify_html_variation', 10, 8 );
I have placed the ee4-email-style.css file into my theme’s child folder.
Is there something I am missing? When I send an Order Complete email to myself, none of my styles are being recognized. Is there a way to check?
Thank you.
yogakeys
October 18, 2018 at 12:23 am
Add New Note to this Reply
add_filter( 'gettext', 'mycustom_filter_gettext', 10, 3 );
is part of something else in my functions.php please ignore.
Josh
October 18, 2018 at 6:53 am
Add New Note to this Reply
Hi,
Your code is actually passing the custom CSS to the Receipts and Invoices only . This block:
if ( $messenger != 'html' ) {
return $variation_path;
}
is basically saying: “If this isn’t an invoice or receipt, move on and just send the regular CSS.”
So in order to send the custom CSS with an email, you’d change that line of code to be:
if ( $messenger != 'email' ) {
return $variation_path;
}
yogakeys
October 18, 2018 at 3:55 pm
Add New Note to this Reply
This works, thanks Josh!