Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save runezero/8ff485e5b7f4adea737d63d7ce1b0114 to your computer and use it in GitHub Desktop.

Select an option

Save runezero/8ff485e5b7f4adea737d63d7ce1b0114 to your computer and use it in GitHub Desktop.
[Gravity mails with Woo Styling] Set the header, footer and body styling within Gravity Mails to WooCommerce Mails #woocommerce #gravityforms
add_filter( 'gform_html_message_template_pre_send_email', 'maybe_enable_wc_template_for_gf_notifications');
function maybe_enable_wc_template_for_gf_notifications($template){
if(class_exists('woocommerce')) {
ob_start();
wc_get_template( 'emails/email-header.php', array( 'email_heading' => '{subject}' ) );
echo '<style>';
wc_get_template( 'emails/email-styles.php');
echo '</style>';
echo '{message}';
wc_get_template( 'emails/email-footer.php' );
$template = ob_get_contents();
ob_end_clean();
return $template;
}
return $template;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment