Occasionally, we end up with a single contact that has two membership records (e.g., an old expired one and a newer current one). I would like to programmatically merge the two memberships cleanly, so that, for example, the remaining membership gets the oldest start date, the current membership type, all contributions are retained, etc. Have browsed Dedupe.php looking for a call that might do this, but to no avail. Any suggestions?

2 Answers 2


Currently there's no support for what you're describing built in to CiviCRM. You could implement this with API calls in an extension. If you do, please consider submitting it to the extensions directory!

  • I would do this, but it's not clear what API calls would enable this. Looking in the API Explorer, for entity Membership, there's no option to "merge" (or anything that looks like that).
    – bugfolder
    Apr 28, 2015 at 11:12
  • 1
    You will have to create the api to merge... which will use the api to update the first membership, move all the contributions from the second to the first membership and then delete the second membership.
    – samuelsov
    May 8, 2015 at 15:04

I’ve started to work on a patch for CiviCRM (as it’s not that simple to implement this as an extension). The work-in-progress PR is available here. Comments and feedbacks are welcome ;)



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.