0

I want to set up a Drupal 9 webform to enable people to buy a gift membership. I don't want to use the Gift Membership extension because it's approach of creating a redeemable code doesn't fit with our business processes: we want to be able to contact the recipient of the gift membership directly as part of the on-boarding process, and create a relationship between the purchaser and the holder of the membership.

So I need the webform to create the two contact records in CiviCRM so that I can then communicate appropriately to both the purchaser and the member.

My work so far on this seems to indicate that this isn't achievable, but I may well be missing a trick. Webform_CiviCRM appears to assume that any contribution is linked to Contact 1 in the form (there's no option to choose the contact that will be linked to the contribution record). If I then specify that I want a membership for Contact 2, the price for the membership doesn't appear to get included, so the total is always 0, and no payment can be processed.

Can I use the 'in honour of' element? (never used it before so I'm unclear as to what it actually does).

Has anyone got anything like this working? Am I doing something wrong?

2

1 Answer 1

0

Here's what I ended up doing. It feels a bit weird, but so far it seems to do the trick.

Having created the fields I need for the two contacts, and ensuring that buyer is contact 1 (because the contribution appears to only work for contact 1), I can then specify a membership that will be applied to contact 2.

Even though I've set a minimum price for the membership in CiviCRM, the form seems to take no notice of this. So in order to have a price appear on the form, in the Civi settings tab for the form I enable a contribution. This still doesn't let me set a price anywhere, so in the form component for Contribution Amount I set a default value - the price I want to set, and I configure the form component so that it is read-only (otherwise the user could edit the price).

The form now looks sensible, a payment gets processed for the right amount, and a membership gets created.

What I need to try to work out now if how I can provide a choice of price options?

1
  • Yes, this seems right, I'm not sure what parts are feeling weird. An important thing about webform civicrm is that it doesn't have the same kinds of built-in hard-coded "business rules" that the civicrm forms have. That's good and bad, but for flexibility and defining those rules yourself, it's definitely good. To answer your last question, I think you would convert the price field to a list box.
    – Alan Dixon
    Nov 14, 2022 at 19:57

Your Answer

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

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