We have a form that allows for donations, for this we have radio buttons with the options of $5, $10, $20, and other amount. If someone selects “other amount” a text field is rendered allowing them to input the donation amount. However, some people who do not want to donate still choose “other amount” and then input “$0” or simply “0” in this text field. We do not want to send a confirmation email if they fill out this form and choose not to donate.
I have tried creating two conditionals on this notification:
Send this notification if ANY of the following match:
Other Amount field “is not” 0
Or
Other Amount field “is not” $0
I’ve also tried:
Other Amount field “greater than” 0
Or
Other Amount field “greater than” $0
Neither of these accomplishes what we want, which is to not send the notification email if someone fills out the form and does not donate. I’ve tried using the “other” choice from the radio buttons, but that led to a different set of issues ( Radio Buttons "other" choice causes error on submission ).
Is there a way to have this form not send a confirmation email if the person selects “other amount” and inputs “zero” or “0” or “$0”?
Hi Thomas,
To disable the email notification when a user selects “Other Amounts” and enters 0 or $0.00, please add the following code to your child theme’s functions.php file or use a Code Snippet plugin.
First, replace the “3” in gform_disable_notification_3 with your form ID. Then, edit your Notification, and from the URL bar, find the “nid” number.
https://xyz.io/wp-admin/admin.php?page=gf_edit_forms&view=settings&subview=notification&id=3&nid=6915837c16509
Copy this number to replace “6915837c16509” in the code below.
add_filter( 'gform_disable_notification_3', function ( $is_disabled, $notification, $form, $entry ) {
// Replace the nid key
if ( rgar( $notification, 'id' ) !== '6915837c16509' ) {
return $is_disabled;
}
// Grab the total
$total = GFCommon::get_total( GFCommon::get_product_fields( $form, $entry, false, false ) );
if ( GFCommon::to_number( $total ) <= 0 ) {
return true; // returning TRUE disables this notification.
}
return $is_disabled;
}, 10, 4 );
This code will now prevent the notification from triggering if a user inputs a donation amount of 0. I’ve tested the code multiple times using various donation amounts, and it works! 
Give it a try, and let me know how that goes! 
1 Like
Thank you that worked perfectly.
1 Like