I see from this post that it's not curently possible to have a choice of preset and user defined donation amounts out of the box, so I thought maybe I could do it by hooks.
I've got a multiple choice field 'Donation' (input_1) with £10, £20, £50 and 'other', and I'm using conditional logic to show the 'Your own amount' field (input_2) if 'other' is chosen.
The problem is the PayPal screen always shows the name of both fields as the item name, which is very confusing. E.g. "Donation, Your own amount" or "£10, Your own amount".
I thought I could use the gform_pre_submission hook to unset input_1 if it is set to 'other', or to unset input_2 otherwise, but this isn't working:
add_filter( 'gform_pre_submission_3', 'only_one_donation_field' );
function only_one_donation_field( $form ) {
if ( isset( $_POST['input_1'] ) and 'other' == $_POST['input_1'] ) {
unset( $_POST['input_1'] );
} else {
unset( $_POST['input_2'] );
}
return $form;
}
Am I doing something wrong or is this just not possible?
Many thanks