Created
June 16, 2015 21:24
-
-
Save Yame-/6cd1133b24bfc6a1f20a to your computer and use it in GitHub Desktop.
Add WooCommerce product with Contact Form 7
This file contains 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 | |
/* Capture CF7 data */ | |
add_action( 'wpcf7_mail_sent', 'wpcf7_capture_data' ); | |
function wpcf7_capture_data( $contact_form ) { | |
$submission = WPCF7_Submission::get_instance(); | |
if ( $submission ) { | |
$posted_data = $submission->get_posted_data(); | |
} | |
// The 999 represents our CF7 form ID | |
if( $posted_data['_wpcf7'] == 999 ) { | |
// Add WooCommerce product | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment