Its possible to set default values of a membership custom fields through a civiCRM hook? I have seen that the values are generated by ajax when membership type is changed but i dont see any hook for this.


1 Answer 1


you should be able to do this with the buildForm hook that is described here: https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm/. Keep in mind that the custom fields are actually posted on a different form, so I usually first dump the form names to the log with Civi::log()->debug so I can check what the name I need is.

  • Thanks for your recommendations, finally, I found the form that works with the custom fields in the memberships: CRM_Custom_Form_CustomDataByType
    – Cesar
    Oct 16, 2018 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.