TransWikia.com

membershipTypeValues hook not updating membership price

CiviCRM Asked on February 1, 2021

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

One Answer

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.

Answered by Pradeep Nayak on February 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP