Skip to content
Docs
Get RestroPress

Filter

rpress_purchase_from_name

Updated
On this page

Filters the sender name used in order emails.

Runs when the customer receipt, the admin order notification and the test receipt are prepared. The default is the From Name setting (from_name), falling back to the site name. For the test receipt the order ID is 0 and the data array is empty.

Parameters#

ParameterTypeDescription
$from_namestringSender name, from the from_name setting or the site name.
$payment_idintID of the order, or 0 for the test receipt.
$payment_dataarrayOrder meta from _rpress_payment_meta, or an empty array for the test receipt.

Return value#

string. The sender name to use.

Example#

function my_purchase_from_name( $from_name, $payment_id, $payment_data ) {
	if ( $payment_id && 'cash_on_delivery' === rpress_get_payment_gateway( $payment_id ) ) {
		return $from_name . ' (Cash orders)';
	}
	return $from_name;
}
add_filter( 'rpress_purchase_from_name', 'my_purchase_from_name', 10, 3 );

Notes#

Fired from the customer receipt, the admin notification and the test receipt. The admin notification passes the $payment_data argument it received, which may be an empty array.

Source#

Applied in:

  • includes/emails/functions.php (line 34), in rpress_email_purchase_receipt()
  • includes/emails/functions.php (line 74), in rpress_email_test_purchase_receipt()
  • includes/emails/functions.php (line 117), in rpress_admin_email_notice()

See also#

Was this page helpful?