X

Add Min or Max Total Purchase Amount in Easy Digital Downloads

This snippet allows you to set a maximum total purchase amount a buyer can spend on your Easy Digital Downloads store. By default, the maximum purchase amount is set to 100. Any purchase above the maximum threshold will return an error. You can change the amount and the error message per your preference.

Instead of maximum amount, if you want to set a minimum total purchase amount, then replace the following line

if( edd_get_cart_total() > 100 ) {

with

if( edd_get_cart_total() < 10 ) {

You can add this snippet to your functions.php file and you’re all set!

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!