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.

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 !!!

  • 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 – Abteilung Gerontopsychiatrie Nov 11 '16 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 – – Ramesh - ARTECH Consultancy Nov 11 '16 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 Aug 2 '17 at 15:31
1

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, ); */ 
  • 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. – William Mortada Apr 12 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, ); */ – Guillaume Sorel Apr 15 at 7:50
  • Thanks. I've added this to your answer. – William Mortada Apr 15 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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