• Resolved lenzo7

    (@lenzo7)


    Hello,is there anyway to delete the Zip code/Postal & Address line 2 fields in the donations form? tried looking in Give Docs but didn’t find an article to help me on this.

    Thank you

Viewing 1 replies (of 1 total)
  • Hi There,

    There is no direct way to do that, but this can be accomplished in the following ways.

    – The Zip code is a required field. Make it a NOT required field using a custom snippet.
    – Hide the Address 2 line and zip code using custom CSS.

    You can make the ZIP code NOT required by adding the following custom snippet to your website.

    
    function give_dont_require_fields( $required_fields, $form_id ) {
    
    	if(isset($required_fields['card_zip'])) {
    		unset($required_fields['card_zip']);
    	}
    
    	return $required_fields;
    }
    add_filter( 'give_donation_form_required_fields', 'give_dont_require_fields', 10, 2 );
    

    If you need any help in adding a custom snippet to your website, you can check this detailed doc here for more help: https://givewp.com/documentation/resources/adding-custom-functions-to-your-wordpress-website/

    Please note that this code snippet is provided as an example of how you can extend Give with code. It’s up to you to implement and customize to your liking. We cannot provide support for custom code on your website, only the code that we create and distribute.

    Then you can add the following custom CSS to your site to hide the fields.

    
    #give-card-address-2-wrap,
    #give-card-zip-wrap {
        display: none;
    }
    

    Add that to the bottom of your theme’s styles.css file or go to “Appearance > Customize > Additional CSS” and add it to the bottom of that setting. For more detailed info on adding custom CSS, see here: https://givewp.com/documentation/resources/handling-custom-css-in-wordpress/

    Thank you!

Viewing 1 replies (of 1 total)
  • The topic ‘Delete Fields in the Donation Form’ is closed to new replies.