How to Change the Payment Delimiter Inside Email Notifications

Overview

Would you like to change the payment delimiter that displays in your email notifications? By default, all payment amounts inside the email notifications are separated with a dash (-) but you can easily change this with a small PHP snippet. In this tutorial, we’ll show you how to change this delimiter.

Setup

To begin, copy and paste this code snippet to your site.

/*
 * Change payment delimiter in the email notification.
 *
 * @link https://wpforms.com/developers/how-to-change-the-payment-delimiter-inside-email-notifications/
 *
*/
function wpf_dev_entry_email_data( $fields, $entry, $form_data ) {
    
	// Only run on my form with ID = 890
	if ( absint( $form_data['id'] ) !== 890 ) {
	return;
	}
	
    foreach ( $fields as &$field ) {

		if ( empty( $field['value_choice'] ) ) {
			continue;
		}
		
		// Default is a dash -, change here to what you need.
		$delimiter = ' : ';
		$field['value'] = $field['value_choice'] . $delimiter . wpforms_format_amount( $field['amount_raw'], true );
	}
	
	return $fields;
	
}
add_filter( 'wpforms_entry_email_data' , 'wpf_dev_entry_email_data', 10, 3  );

This code snippet will change the Dropdown, Checkbox and Multiple Choice payment form fields for the form 890.

By adding this code snippet you can change the payment delimiter in email notifications from a dash to a colon
And that’s it! You’ve successfully changed the delimiter. Would you like to also like to send metadata to Stripe when the payment is processed? Take a look at our tutorial on How To Send Metadata to Stripe Payments.

Filter Reference: wpforms_entry_email_data