Created
October 8, 2019 21:37
-
-
Save dparker1005/b7bd4ff05e606d2ef7ee8d04ada430d1 to your computer and use it in GitHub Desktop.
Remove auto-renewal checkbox when discount code is entered. Should fix https://github.com/strangerstudios/pmpro-auto-renewal-checkbox/issues/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 | |
// Copy from below here | |
function my_pmproarc_remove_checkbox_with_discount_code() { | |
?> | |
<script> | |
jQuery(document).ready(function() { | |
// After any AJAX call... | |
jQuery( document ).ajaxComplete(function() { | |
// If the current discount code was updated... | |
if( jQuery ( "#pmpro_level_cost p" ).length > 1) { | |
// Hide auto-renewal checkbox | |
jQuery('#pmpro_autorenewal_checkbox').remove(); | |
} | |
}); | |
}); | |
</script> | |
<?php | |
} | |
add_action( 'pmpro_checkout_boxes', 'my_pmproarc_remove_checkbox_with_discount_code' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment