Last active
June 8, 2019 02:31
-
-
Save jb510/3bdc0203fa6f2561f332051a1de0e610 to your computer and use it in GitHub Desktop.
Jilt Early email capture, front end only
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 | |
/** | |
* Adds listener to Email popup form and send email to Jilt for Cart Recovery | |
* | |
* @return void | |
*/ | |
if ( !is_admin() ) { | |
add_action( | |
'init', function() { | |
// set your input name to watch here | |
$input = 'EMAIL'; | |
if ( function_exists( 'wc_enqueue_js' ) ) { | |
$js = 'jQuery(\'input[name="' . $input . '"]\').typeWatch({ callback: function (value) { if ( JiltStorefront.Helpers.isValidEmail( value ) ) { jilt.setCustomer({email: value }); } }, wait: 1250, highlight: false, allowSubmit: false, captureLength: 6 });'; | |
wc_enqueue_js( $js ); | |
} | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment