• Resolved napsinbklyn

    (@napsinbklyn)


    Hi there!
    Thanks again for your help earlier, this plugin is great and I appreciate the support and speedy replies.
    I am customizing a Give form through the filters in my functions file, and I have successfully made adjustments to some of the filter examples I have found, but looking for help to make the custom donation amount selection the default, or alternatively, to make the $____ field at the top empty.
    It was suggested to me that having this field filled implied that was the suggested donation amount, whereas they would prefer to leave that up to the patron.
    Thanks!

    https://www.ads-software.com/plugins/give/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Devin Walker

    (@dlocc)

    Nice request. This should be possible, but I just checked and we are lacking a filter for that. I added a new filter called give_default_form_amount which will be released in the next version this week. If you need it now it’s on our Github. Here’s the issue for reference https://github.com/WordImpress/Give/issues/301

    Thread Starter napsinbklyn

    (@napsinbklyn)

    Hi Devin,
    Thanks so much for your help, I just installed the latest update.
    I was able to use this filter, but I am not sure which format to use or which options are available.
    I tried typing in the following:

    <?php
    add_filter('give_default_form_amount', 'new_default_form_text');
    function new_default_form_text () {
    	return __('&nbsp;', 'give');
    }
    ?>

    I’m getting an error:
    “Warning: number_format() expects parameter 1 to be double, string given in /wp-content/plugins/give/includes/formatting.php on line 109”

    Can I use non-numeric values? It works when I type in 0 but we would prefer to have it blank.
    Matt suggested that I use javascript, but I’m not very experienced in writing it.
    Thanks again!

    Plugin Author Devin Walker

    (@dlocc)

    Yeah I would suggest probably using JavaScript too… It seems better for this type of thing. Something like this would work:

    <script>
    //Removing default donation value using JS
    ( function( $ ) {
    
    	//Remove for set amounts
    	$('span#give-amount' ).text(' ');
    	//Remove for
    	$('input#give-amount' ).val('');
    	//Optional: focusin on load
    	$('input#give-amount' ).focus();
    
    } )( jQuery );
    </script>
    
    Thread Starter napsinbklyn

    (@napsinbklyn)

    Cool, that works great. I really appreciate your help with customizing. You guys are awesome!

    Plugin Author Devin Walker

    (@dlocc)

    Hey thanks! ??

    Thread Starter napsinbklyn

    (@napsinbklyn)

    Just noticed with the new update that I can submit a donation of 0.00.
    Is there a minimum requirement option? Should it work that way?
    Also, the payment method says “Test Donation” on the receipt, which isn’t right.

    Plugin Author Devin Walker

    (@dlocc)

    Hey @napsinbklyn – please open a new topic with this issue as it’s unrelated to the original one here.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Make custom donation amount the default or empty field’ is closed to new replies.