Skip to content
Docs
Get RestroPress

Filter

rpress_order_notification_extra_emails

Updated
On this page

Filters extra customer emails listed under the Order Notifications settings.

Lets a feature add its own email to Settings > Emails > Order Notifications, with the same enable, subject, heading and content fields as the built-in order status emails. Entries are keyed by the option name used to store the settings. Keys that are empty, non-array entries, keys matching an order status, and 'admin_notification' are discarded, and missing fields are filled with defaults.

Parameters#

ParameterTypeDescription
$emailsarrayExtra emails, empty by default. Each key maps to an array with 'label', 'recipient', 'enabled', 'subject', 'heading' and 'content'.

Return value#

array. Extra emails keyed by option name.

Example#

add_filter( 'rpress_order_notification_extra_emails', 'my_extra_order_emails', 10, 1 );
function my_extra_order_emails( $emails ) {
	$emails['my_order_ready_sms'] = array(
		'label'     => __( 'Order ready reminder', 'my-plugin' ),
		'recipient' => __( 'Customer', 'my-plugin' ),
		'enabled'   => false,
		'subject'   => __( 'Your order is ready', 'my-plugin' ),
		'heading'   => __( 'Ready for pickup', 'my-plugin' ),
		'content'   => __( 'Your order is ready.', 'my-plugin' ),
	);
	return $emails;
}

Notes#

Return value is read through rpress_get_extra_order_notification_emails(), which sanitises keys with sanitize_key().

Source#

Applied in:

  • includes/admin/settings/register-settings.php (line 3263), in rpress_get_extra_order_notification_emails()

See also#

Was this page helpful?