How to Change the Payment Delimiter Inside Email Notifications

Would you like to change the payment delimiter in email notifications? By default, all payment amounts inside the email notifications are separated with a hyphen (-), which may not always suit your preferences or requirements. Changing the payment delimiter can improve the readability of your email notifications, especially if you need to align with specific formatting guidelines or make the amounts more distinguishable. In this guide, we’ll walk you through the steps to customize the payment delimiter in your email notifications, ensuring that your emails are clear, professional, and tailored to your needs.

payment delimiter inside email notification by default will show a hyphen

Changing the payment delimiter

Simply copy this snippet to your site and update the : to match the separator you would like to use.

If you need any help in knowing where or how to add snippets to your site, please review this tutorial.

/*
 * Change the 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 = 310.
   if ( absint( $form_data[ 'id' ] ) !== 310 ) {
      return $fields;
   }

   foreach ( $fields as $field_id => $field ) {

      if ( empty( $field[ 'value_choice' ] ) ) {
         continue;
      }

      // Default is a dash -, change here to what you need.
      $delimiter = ' : ';

      $fields[ $field_id ][ '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 from using the default hyphen to a colon (:).

You’ll need to update the form ID in the snippet to match your form ID. If you’re not sure how to find your form ID, please check out this tutorial.

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 change this when viewing the form? Check out our article on How to Customize Payment Form Labels.

Reference Filter

wpforms_entry_email_data