Add filter before email send
-
Hey,
I’m the developer of the Kadence WooCommerce Email Designer plugin.I love your plugin and would like to add special support for it in my email designer plugin.
I’ve built out some testing support that would allow users to send your abandon cart emails as html emails designed the same way their transactional emails are designed. They would also be able to preview the emails in my plugin.
For this, to work I would need you to add a couple of lines of code to your plugin to allow the emails to be filtered through woocommerce before they are sent.
One example for how this could work would be to change lines 1710-1720 of class-cartflows-ca-cart-abandonment.php from this:
$mail_result = wp_mail( $email_data->email, $subject_email_preview, stripslashes( $body_email_preview ), $headers ); if ( $mail_result ) { return true; } else { // Retry sending mail. $mail_result = wp_mail( $email_data->email, $subject_email_preview, stripslashes( $body_email_preview ), $headers ); if ( ! $preview_email ) { return true; } return false; }
To this:
$mail_result = apply_filters( 'woo_cart_abandonment_recovery_email_override', false, $email_data->email, $subject_email_preview, stripslashes( $body_email_preview ), $headers, $email_data ); if ( $mail_result ) { return true; } else { $mail_result = wp_mail( $email_data->email, $subject_email_preview, stripslashes( $body_email_preview ), $headers ); if ( $mail_result ) { return true; } else { // Retry sending mail. $mail_result = wp_mail( $email_data->email, $subject_email_preview, stripslashes( $body_email_preview ), $headers ); if ( ! $preview_email ) { return true; } return false; } }
Please let me know if adding a filter would be possible and if I can help by submitting a pull request.
Thanks for your time!
Ben
- The topic ‘Add filter before email send’ is closed to new replies.