3

On my civicrm contribution page I have a field that I want to use to calculate the membership price.

Currently Im trying to use the membershipTypeValues hook to edit the price after the contribution page has been submitted

Heres the code

add_filter('civicrm_membershipTypeValues', "updatePrice", 10, 2);

function updatePrice(&$form, &$membershipTypeValues) {
    $membershipTypeValues[14]['minimum_fee'] = "40.00";
}

Theoretically this should change the membership price to $40 but the price doesn't change on the conformation screen.

The code runs and if I print out the $membershipTypeValues array I can see the minimum fee has changed to $40

Any ideas on how to fix this would be great

Thank you

1 Answer 1

2

I think you need to use hook_civicrm_buildAmount or hook_civicrm_buildForm hook to change the amount on front end contribution/event pages for priceset or line items.

1
  • Thank you, you're right I needed to use buildAmount
    – Jeremy
    Sep 2, 2020 at 16:21

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.