X

Disable emails on free purchases in Easy Digital Downloads

If you are running EDD and you are sick of getting admin emails or sending them with free purchase you can disable this with a few lines of code. The snippet for EDD will disable both the customer purchase receipts and admin notice emails for free purchases. If you want to just send emails to clients but not the admin just remove or comment out the remove_action for edd_complete_purchase or vice versa and you are set.


Code Snippet:


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

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!