Created
March 2, 2018 12:31
-
-
Save New0/63efa2838a01577a6752b0a5cca871ce to your computer and use it in GitHub Desktop.
Send email when Stripe payment with Caldera Forms failed after process
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'caldera_forms_redirect', function( $type, $url, $form ){ | |
//Change the Form ID | |
if( $form['ID'] === 'CF5a5e8452c6f82' ) { | |
//Set the recipient the sbuject and the message | |
$recipient = '[email protected]'; | |
$subject = 'My Email Subject'; | |
$message = 'My Email content'; | |
global $transdata; | |
$form['mailer']['recipients'] = $recipient; | |
$form['mailer']['email_subject'] = $subject; | |
$form['mailer']['email_message'] = $message; | |
if( $transdata['type'] === 'error' && $transdata['note'] === 'Your card was declined.' ) { | |
Caldera_Forms_Save_Final::do_mailer( $form, null, $transdata['data'] ); | |
} | |
} | |
}, 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment