Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created February 27, 2020 08:08
Show Gist options
  • Save andrewlimaza/2d4ac6c391804130304510e3274a936f to your computer and use it in GitHub Desktop.
Save andrewlimaza/2d4ac6c391804130304510e3274a936f to your computer and use it in GitHub Desktop.
Remove Auto Renewal Checkbox if check is selected.
<?php
// Add this code to your PMPro Customizations Plugin or Code Snippet plugin.
function my_footer_script() {
global $pmpro_pages;
if ( is_page($pmpro_pages['checkout'] ) ) {
?>
<script>
jQuery(document).ready(function(){
jQuery('#pmpro_payment_method input').on('click', function(){
if ( jQuery(this).val() == 'check' ) {
jQuery('#pmpro_autorenewal_checkbox').hide();
jQuery('.pmpro_checkout_field-autorenew #autorenew').prop('checked', false );
} else {
jQuery('#pmpro_autorenewal_checkbox').show();
}
});
});
</script>
<?php
} // end of if statement
}
add_action( 'wp_footer', 'my_footer_script' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment