Add min or max total purchase amount in Easy Digital Downloads

This snippet will add max total purchase amount. If your purchase is greater than $100 this will return an error. You could do the same thing for minimum amount requiring a minimum of $10 or another amount before you can make a purchase. To set a minimum purchase you can change the following line if( edd_get_cart_total() > 100 ) { to if( edd_get_cart_total() < 10 ) { ( If total is less than $10 ). You will of course want to change the error message that is display but I'm sure you get the idea. Add this snippet to the functions.php of your WordPress theme and you are all set.

Code Snippet:

function pw_edd_limit_total_purchase( $valid_data, $post_data ) {

if( edd_get_cart_total() > 100 ) {
edd_set_error( 'too_much', 'You cannot purchase that much at one time.' );

add_action( 'edd_checkout_error_checks', 'pw_edd_limit_total_purchase' );

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!