1

I understand that on contribution pages the "Billing Name and Address" block pops up in default - for most payment types. Where can I set what fields I want to have displayed -> I don't want the "middle name" and I certainly don't want a "State/Province" field when it's mandatory to start with. I can CSS them out -> but is there a back office way to choose what is shown? Cheers.

This is Wordpress.

2 Answers 2

1

To my Knowledge:-

For some reason billing address field selection is hard coded in core files

getBillingAddressFields()

so you are forced to list all the listed fields details - if you dont want to display specific details then:

  • you need to overriding the core files Or
  • A JAVA script to hide the fields and unset the fields in formbuild

I guess this helps !!!

3
  • 1
    Thanks Ramesh! I haven't yet reached the level needed to tweek CiviCRM using JS. It therefore seems easier taking the fields out of the Payment.php (somewhere around line 710++) - albeit having to redo that in a case of updates. Would you agree!? Cheers Commented Nov 11, 2016 at 10:50
  • Indeed - will be the quicker option but need to make a note of the changes and also need to test in all the possible way – Commented Nov 11, 2016 at 11:16
  • I looked through all the Payment.php files I could find in 4.7.22 and couldn't spot any fields with 'postal' in them. Any ideas? Also, the main file generating the payment block treats all fields as required; there's no apparent opportunity to make individual fields required or not. See CRM/Core/Payment/Form.php, around li 135. Forgive me if I'm missing something completely obvious here... :)
    – Andyg8
    Commented Aug 2, 2017 at 15:31
3

Thanks, I changed the file Core/Payment.php file at lines 863 and 901 for both credit cards and checks.

You can set the paramaters that are needed for the billing address by adding comment in the wp-content/plugins/civicrm/civicrm/CRM/Core/Payment.php. For example for the middle name that we don't use in France:

line 901

/** $metadata['billing_middle_name'] = array( 'htmlType' => 'text', 'name' => 'billing_middle_name', 'title' => ts('Billing Middle Name'), 'cc_field' => TRUE, 'attributes' => array( 'size' => 30, 'maxlength' => 60, 'autocomplete' => 'off', ), 'is_required' => FALSE, ); */ 
3
  • Thanks for your post but it is unclear if you are trying to make a comment or to answer the original question. If this is an answer to the question it would be helpful if you could provide some more details. This could help other people with the same question. Commented Apr 12, 2019 at 19:31
  • 1
    This was an answer. you can set the paramaters that are needed for the billing address by adding comment in the wp-content/plugins/civicrm/civicrm/CRM/Core/Payment.php For example for the middle name that we don't use in France: line 901 /** $metadata['billing_middle_name'] = array( 'htmlType' => 'text', 'name' => 'billing_middle_name', 'title' => ts('Billing Middle Name'), 'cc_field' => TRUE, 'attributes' => array( 'size' => 30, 'maxlength' => 60, 'autocomplete' => 'off', ), 'is_required' => FALSE, ); */ Commented Apr 15, 2019 at 7:50
  • Thanks. I've added this to your answer. Commented Apr 15, 2019 at 8:12

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.