Home / Admin / Send Sale Alerts From Customer Email
Duplicate Snippet

Embed Snippet on Your Site

Send Sale Alerts From Customer Email

Sets the From address of New Sale alert emails to the customer's email address

Code Preview
php
<?php
class EDD_SAFCE {
	public function __construct() {
		add_action( 'edd_admin_sale_notice', array( $this, 'set_payment_id' ), -1000, 2 );
		add_action( 'edd_email_send_before', array( $this, 'set_from_address' ) );
	}
	public function set_payment_id( $payment_id, $payment_data ) {
		global $edd_payment_id;
		$edd_payment_id = $payment_id;
	}
	public function set_from_address( $emails_class ) {
		global $edd_payment_id;
		if( empty( $edd_payment_id ) ) {
			return;
		}
		$emails_class->from_address = edd_get_payment_user_email( $edd_payment_id );
	}
}
new EDD_SAFCE;

Comments

Add a Comment