Skip to content

Instantly share code, notes, and snippets.

@matheuswd
Last active September 8, 2020 13:40
Show Gist options
  • Save matheuswd/01dcefdf3c52c154954783a3c445ab8e to your computer and use it in GitHub Desktop.
Save matheuswd/01dcefdf3c52c154954783a3c445ab8e to your computer and use it in GitHub Desktop.
<?php
function hide_recurring_option_for_offline_payment() { ?>
<script>
let paymentMethodOff = jQuery('input[value="offline"]');
let recurringOption = jQuery('div.give-recurring-donors-choice');
let recurringData = jQuery('input[name="_give_is_donation_recurring"]');
if(true === paymentMethodOff.prop('checked')) {
recurringOption.prop('checked', false);
recurringData.prop('value', 0);
recurringOption.hide();
} else {
recurringOption.show();
}
</script>
<?php
}
add_action( 'give_donation_form_after_submit', 'hide_recurring_option_for_offline_payment' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment