Have you ever created an order form or donation form, only to have a user accidentally submit a payment of $0? Since users are unlikely to see the problem if they can still submit the form, this could result in confusion and frustration.
In this tutorial, we’ll show you how to require that a form includes a payment amount greater than $0 before it can be submitted.
Before you dive into this tutorial, make sure WPForms is installed and activated on your WordPress site. Then create a new form or edit an existing one to access the form builder.
If you would like to accept payments with this form, you’ll also need to make sure you’ve installed and set up one of our payment addons. You can find complete tutorials on each of the available options below:
Requiring a Payment Total
To require a payment amount for your form, you need to add a Total field. You’ll find this field under Payment Fields in the form builder. Click on it or drag and drop it into the preview area to add it to your form.
Then click on the Total field in the preview area to open its field options. Here, toggle on the Required setting.
Make sure to save your changes. Then you can embed your form on a page to publish it.
Note: We recommend testing your form before you publish it to make sure it works as expected. See our complete form testing checklist for a step-by-step guide.
If a user tries to submit your form with $0 in the Total field, they will see a validation message that reads, “Payment is required.”
Note: Want to change the message users will see if they try to submit your form and the Total field amount is $0? Check out our tutorial on customizing validation messages.
That’s it! You now know how to require the Total field to have an amount greater than $0 before users can submit your form.
Next, would you like to offer multiple payment methods in a single form? Follow our guide to let users choose their payment method.