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


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.

  • 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 you have read our privacy policy.

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