X

Disable Emails on Free Purchases in Easy Digital Downloads

The snippet disables both the customer purchase receipts and admin notice emails on your EDD store for free purchases. All you have to do is add this snippet to your functions.php file.

If you want to send emails to your customers but not to admin, then you can remove or comment out the remove_action for edd_complete_purchase.

Similarly, if you want to send emails to admin but not to customers, then you can remove or comment out the remove_action for edd_admin_sale_notice.

function jp_no_email_free( $payment_id ) {

	$amount = edd_get_payment_amount( $payment_id );
	if ( 0 == $amount ) {
		remove_action( 'edd_complete_purchase', 'edd_trigger_purchase_receipt', 999, 1 ); // This disables customer purchase receipts
		remove_action( 'edd_admin_sale_notice', 'edd_admin_email_notice', 10, 2 ); // This disables email notices to admins
	}
}
add_action( 'edd_complete_purchase', 'jp_no_email_free', 998, 1 );

Comments  Leave a Reply

  1. Great!

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!