Are you looking for a way to disable the customer purchase receipts and admin notice emails on your Easy Digital Downloads store? While there’s probably a plugin for this, we have created a quick code snippet that you can use to disable emails on free purchases in Easy Digital Downloads.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
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 );
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
.
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 25 best WooCommerce plugins to grow your sales and how to increase maximum file upload size in WordPress.
Hey there! Would it be possible to modify this snippet to disable the purchase receipt email for a specific paid download?
Hey Clayton, thanks for your comment. I’m sorry but right now we don’t have a code for this specific request.
Great!