On contribution pages, I've been able to do this for price sets e.g.
However, I've not been able to get this to work on event pages? What's different and is this possible?
CiviCRM Stack Exchange is a question and answer site for administrators and users of the CiviCRM Constituent Relationship Management software. It only takes a minute to sign up.Sign up to join this community
The Contribution form has this code in the
$priceFieldName = 'price_' . $values['price_field_id']; $priceFieldValue = CRM_Price_BAO_PriceSet::getPriceFieldValueFromURL($this, $priceFieldName);
It should be possible to implement it for events too. Check out the
setDefaultValues function in
CRM/Event/Form/Registration/Register.php, inside the loop here:
I haven't tested it, but if it works for you, I would encourage you to send a pull-request so that it gets reviewed and tested, and eventually included in a future version. It's a useful feature indeed. I can also help with the PR.