Forked from andrewlimaza/remove-auto-renewal-checkbox.php
Last active
January 9, 2025 08:17
-
-
Save dwanjuki/24eb7fa6cd9d26381e0a3920bfcc3862 to your computer and use it in GitHub Desktop.
Remove Auto Renewal Checkbox if Pay by Check is selected
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 | |
/** | |
* Remove Auto Renewal Checkbox if Pay by Check is selected | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_hide_arc_if_pbc_selected_script() { | |
if ( function_exists( 'pmpro_is_checkout' ) && pmpro_is_checkout() && function_exists( 'pmproarc_pmpro_checkout_boxes' ) && function_exists( 'pmpropbc_checkout_boxes' ) ) { | |
?> | |
<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_autorenewal_checkbox #autorenew').prop('checked', false); | |
} else { | |
jQuery('#pmpro_autorenewal_checkbox').show(); | |
} | |
}); | |
}); | |
</script> | |
<?php | |
} | |
} | |
add_action( 'wp_footer', 'my_hide_arc_if_pbc_selected_script' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment