Title: User Defined Amount Hack
Last modified: August 21, 2016

---

# User Defined Amount Hack

 *  [bamforp](https://wordpress.org/support/users/bamforp/)
 * (@bamforp)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/user-defined-amount-hack/)
 * Hi Johan – nice plugin. Just wanted to share a hack I made to allow users to 
   enter a custom amount if the ‘amount’ field is left empty. In paypal-button.php
   around line 20 I added an else statement. Might be worth considering for a future
   update as I notice a couple of folks have asked for something similar.
 * regards
 * Peter
 *  `if ($amount) {
    $paypal_btn .= ‘<input type=”hidden” name=”amount” value=”‘.
   apply_filters( ‘paypal_donations_amount’, $amount ) . ‘” />’; } else {
 *  // Customised code added here …
    $paypal_btn .= ‘or enter an amount<br>’; $paypal_btn.
   = ‘<input type=”text” pattern=”[\d\.]*” name=”amount” value=”‘ . apply_filters(‘
   paypal_donations_amount’, $amount ) . ‘” /><br>’; }`
 * [http://wordpress.org/plugins/paypal-donations/](http://wordpress.org/plugins/paypal-donations/)

The topic ‘User Defined Amount Hack’ is closed to new replies.

 * ![](https://ps.w.org/paypal-donations/assets/icon.svg?rev=994082)
 * [Donations via PayPal](https://wordpress.org/plugins/paypal-donations/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/paypal-donations/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/paypal-donations/)
 * [Active Topics](https://wordpress.org/support/plugin/paypal-donations/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/paypal-donations/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/paypal-donations/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [bamforp](https://wordpress.org/support/users/bamforp/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/user-defined-amount-hack/)
 * Status: not resolved