Remove Section

/** * You may decide that you do not need some of the sections in the Profile form at all. * This code will allow you to remove an entire section. * * If you just want to remove individual…Continue reading

Remove Organisation Field

/** * Remove “organisation” from the profile form. */ function ed_remove_organisation_from_profile( $fields ) { unset( $fields[ ‘organisation’ ] ); return $fields; } add_filter( ‘charitable_user_fields’, ‘ed_remove_organisation_from_profile’ );Continue reading

Add User Field

/** * This adds a field to the end of the “Your Details” section in the Profile form. * * In this example, we add a Birthday field, which is a date field. * * @param array $fields * @param…Continue reading

Allow Zero Dollar Donations

/** * Allow people to “donate” $0. */ function ed_charitable_set_minimum_donation_amount() { return 0; } add_filter( ‘charitable_minimum_donation_amount’, ‘ed_charitable_set_minimum_donation_amount’ ); /** * You need to specifically enable $0 donations. */ add_filter( ‘charitable_permit_0_donation’, ‘__return_true’ );Continue reading

Change Section Headers Per Campaign

/** * Change the section headers in the donation form. * * @param array $fields All the donation form fields. * @return array */ function ed_charitable_change_donation_form_section_headers_per_campaign( $fields, $form ) { if ( 123 === $form->get_campaign()->ID ) { // Section headers…Continue reading

Add Empty Option To Countries List

/** * In this example we add an empty “Select your country” * option at the start of the list of countries in the * donation form. */ add_action( ‘init’, function() { $fields = charitable()->donation_fields(); $field = $fields->get_field( ‘country’ );…Continue reading

Make Donor Address Required

/** * Make all address fields required. * * As of Charitable 1.6 the approach below is the recommended way of achieving this. * If you are using an older version of Charitable, see the legacy version below: * *…Continue reading

Change State To Province

/** * Change the “State” field into a “Province” field. * * @param array[] $fields * @return array[] */ add_action( ‘init’, function ( $fields ) { $fields = charitable()->donation_fields(); $field = $fields->get_field( ‘state’ ); $field->label = ‘Province’; $field->set( ‘donation_form’, ‘label’,…Continue reading

Set Minimum Donation Amount

/** * Set the minimum donation amount required. * * This requires Charitable 1.5+. If you are using a previous version: * * @see https://github.com/Charitable/library/blob/master/donation-form/legacy/set-minimum-donation-amount.php */ function ed_charitable_set_minimum_donation_amount() { return 2; } add_filter( ‘charitable_minimum_donation_amount’, ‘ed_charitable_set_minimum_donation_amount’ );Continue reading