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

Set Default Donation Amount Per Campaign

/** * Customize the default donation amount on a per campaign basis. * * @see https://github.com/Charitable/library/blob/master/donation-form/set-default-donation-amount.php * * @param float|int $amount The amount to be filtered. $0 by default. * @param Charitable_Campaign $campaign The instance of `Charitable_Campaign`. * @return float|int…Continue reading

Set Fixed Donation Amount

/** * Automatically set the donation amount and recurring * period for donations. * * @param array $fields * @return array */ function ed_charitable_set_donation_amount( $fields ) { unset( $fields[‘donation_fields’] ); // The amount you would like to donate. $amount =…Continue reading

Remove Terms Fields

/** * If you would like to enable the terms and conditions, privacy * policy and user contact consent fields in the registration form * but NOT the donation form, you can add the following bit of code. */ add_filter(…Continue reading

Move User Fields In Donation Form

/** * In this example we move the user fields section (the “Your Details” bit) to * appear below the payment fields. */ function ed_charitable_move_user_fields_in_donation_form( $fields ) { if ( ! array_key_exists( ‘details_fields’, $fields ) ) { $fields[‘user_fields’][‘priority’] = 80;…Continue reading

Change Custom Amount Field Label Per Campaign

/** * Filter the custom amount field description on a per campaign basis. * * @param string $label The default label. * @return string */ function ed_charitable_donation_form_set_custom_amount_field_text_per_campaign( $label ) { $campaign_id = charitable_get_current_campaign_id(); if ( 226 === $campaign_id ) {…Continue reading

Set State Field To Us States Dropdown With Default

/** * 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’ ); // Change it to a select/drop-down…Continue reading