3

I'm trying to recalculate the final payment value of a contribute page that I'm using on a webform.

Depending on the value of certain fields recorded when submitting the form (the fields are custom fields attached to contacts), the membership fee needs to increase or decrease.

I've looked at the civicrm preprocess and postprocess hooks although it seems they're only called when the form is finally submitted. I need to chance the value before the form is submitted so the correct payment value is passed to the payment processor.

1

Webform conditionals might work for you, if you:

  • Add the membership fee field as a hidden field
  • Set the value of it via conditional rules

Conditional rules can be along the lines of:

if custom_field_color is blue then membership fee = $100

if custom_field_color is yellow then membership fee = $50

Unfortunately they can't perform math so if you needed to combine multiple values you'd need something more sophisticated like custom code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy