Overview
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 (-).
But you can easily change this with a small PHP snippet. In this tutorial, we’re going to show you how!
Setup
First, you’ll need to copy the snippet to your site.
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.
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.
Related
Filter Reference: wpforms_entry_email_data